Skip to content

Commit 8931d2f

Browse files
committed
feat: support css-loader @value
1 parent 161e968 commit 8931d2f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/index.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ const ruleFunction = (properties, options, context = {}) => (root, result) => {
112112
const autoFixFuncNormalized = getAutoFixFunc(autoFixFunc)
113113
const reKeywords = ignoreKeywords ? {} : null
114114
const reValues = ignoreValues ? {} : null
115+
const cssLoaderValues = {}
116+
117+
root.walkAtRules('value', (rule) => {
118+
const { params } = rule
119+
const name = params.split(':')[0].trim()
120+
121+
cssLoaderValues[name] = true
122+
})
115123

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

177185
// test variable
178186
if (ignoreVariables) {
179-
validVar = reVar.test(value)
187+
validVar = reVar.test(value) || cssLoaderValues[value]
180188
}
181189

182190
// test function

0 commit comments

Comments
 (0)