Skip to content

Commit 3ef7185

Browse files
committed
add missing negated rule
1 parent b7ccef6 commit 3ef7185

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

packages/@tailwindcss-upgrade/src/migrate-js-config.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,11 @@ async function migrateContent(
274274
throw new Error('Unsupported content value: ' + pattern)
275275
}
276276

277-
let sourceFiles = patternSourceFiles({ base, pattern })
277+
let sourceFiles = patternSourceFiles({
278+
base,
279+
pattern: pattern[0] === '!' ? pattern.slice(1) : pattern,
280+
negated: pattern[0] === '!',
281+
})
278282

279283
let autoContentContainsAllSourceFiles = true
280284
for (let sourceFile of sourceFiles) {
@@ -375,12 +379,20 @@ function keyframesToCss(keyframes: Record<string, unknown>): string {
375379
}
376380

377381
function autodetectedSourceFiles(base: string) {
378-
let scanner = new Scanner({ sources: [{ base, pattern: '**/*' }] })
382+
let scanner = new Scanner({
383+
sources: [
384+
{
385+
base,
386+
pattern: '**/*',
387+
negated: false,
388+
},
389+
],
390+
})
379391
scanner.scan()
380392
return scanner.files
381393
}
382394

383-
function patternSourceFiles(source: { base: string; pattern: string }): string[] {
395+
function patternSourceFiles(source: { base: string; pattern: string; negated: boolean }): string[] {
384396
let scanner = new Scanner({ sources: [source] })
385397
scanner.scan()
386398
return scanner.files

0 commit comments

Comments
 (0)