Skip to content

Commit

Permalink
feat: support css-loader @value
Browse files Browse the repository at this point in the history
  • Loading branch information
AndyOGo committed May 29, 2020
1 parent 161e968 commit 8931d2f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ const ruleFunction = (properties, options, context = {}) => (root, result) => {
const autoFixFuncNormalized = getAutoFixFunc(autoFixFunc)
const reKeywords = ignoreKeywords ? {} : null
const reValues = ignoreValues ? {} : null
const cssLoaderValues = {}

root.walkAtRules('value', (rule) => {
const { params } = rule
const name = params.split(':')[0].trim()

cssLoaderValues[name] = true
})

// loop through all properties
properties.forEach((property) => {
Expand Down Expand Up @@ -176,7 +184,7 @@ const ruleFunction = (properties, options, context = {}) => (root, result) => {

// test variable
if (ignoreVariables) {
validVar = reVar.test(value)
validVar = reVar.test(value) || cssLoaderValues[value]
}

// test function
Expand Down

0 comments on commit 8931d2f

Please sign in to comment.