Skip to content

Commit 9dd29d0

Browse files
Don't use regex for case-insensitive string comparisons
1 parent 8afbcdc commit 9dd29d0

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/tailwindcss/src/at-import.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,16 @@ function parseImportParams(params: ValueParser.ValueAstNode[]) {
8686
continue
8787
}
8888

89-
if (node.kind === 'function' && /^url$/i.test(node.value)) {
89+
if (node.kind === 'function' && node.value.toLowerCase() === 'url') {
9090
throw new Error('url functions are not supported')
9191
}
9292

9393
if (!uri) throw new Error('Unable to find uri')
9494

95-
if ((node.kind === 'word' || node.kind === 'function') && /^layer$/i.test(node.value)) {
95+
if (
96+
(node.kind === 'word' || node.kind === 'function') &&
97+
node.value.toLowerCase() === 'layer'
98+
) {
9699
if (layer) throw new Error('Multiple layers')
97100
if (supports) throw new Error('layers must be defined before support conditions')
98101

@@ -105,7 +108,7 @@ function parseImportParams(params: ValueParser.ValueAstNode[]) {
105108
continue
106109
}
107110

108-
if (node.kind === 'function' && /^supports$/i.test(node.value)) {
111+
if (node.kind === 'function' && node.value.toLowerCase() === 'supports') {
109112
if (supports) throw new Error('Multiple support conditions')
110113
supports = ValueParser.toCss(node.nodes)
111114
continue

0 commit comments

Comments
 (0)