Simplify
This commit is contained in:
parent
67fc3c30e5
commit
e83435295d
1 changed files with 5 additions and 10 deletions
|
|
@ -24,11 +24,11 @@ export class CssBasedConfig {
|
|||
|
||||
rules.forEach(rule => {
|
||||
rule.walkDecls((decl) => {
|
||||
if (decl.prop.startsWith('--')) {
|
||||
this.parseVariable(decl)
|
||||
} else {
|
||||
if (!decl.prop.startsWith('--')) {
|
||||
throw decl.error('Only CSS variables are allowed in `:theme`')
|
||||
}
|
||||
|
||||
this.parseVariable(decl)
|
||||
})
|
||||
|
||||
// Allow the variables to be used with var() anywhere in CSS
|
||||
|
|
@ -45,13 +45,8 @@ export class CssBasedConfig {
|
|||
* @returns {import('postcss').Rule[]}
|
||||
*/
|
||||
getThemeRules(root) {
|
||||
let rules = []
|
||||
|
||||
root.each(node => {
|
||||
if (node.type === 'rule' && node.selector === ':theme') {
|
||||
rules.push(node)
|
||||
}
|
||||
})
|
||||
/** @type {any[]} */
|
||||
let rules = root.nodes.filter(node => node.type === 'rule' && node.selector === ':theme')
|
||||
|
||||
return rules
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue