Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for dynamically adding @source
  • Loading branch information
philipp-spiess committed Oct 3, 2024
commit 6ea41a61217ea7ff2e2391abf335806159c78f12
18 changes: 18 additions & 0 deletions integrations/postcss/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,10 @@ test(
const className = "content-['b/src/index.js']"
module.exports = { className }
`,
'project-c/src/index.js': js`
const className = "content-['c/src/index.js']"
module.exports = { className }
`,
},
},
async ({ root, fs, spawn }) => {
Expand Down Expand Up @@ -444,5 +448,19 @@ test(
}
`,
])

// Adding a new @source directive will scan for new candidates
await fs.write(
'project-a/src/index.css',
css`
@import 'tailwindcss/utilities';
@import './custom-theme.css';
@config '../tailwind.config.js';
@source '../../project-b/src/**/*.html';
@plugin '../plugin.js';
@source '../../project-c/src/**/*.js';
`,
)
await fs.expectFileToContain('project-a/dist/out.css', [candidate`content-['c/src/index.js']`])
},
)
1 change: 0 additions & 1 deletion packages/@tailwindcss-postcss/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ let cache = new QuickLRU<string, CacheEntry>({ maxSize: 50 })

function getContextFromCache(inputFile: string, opts: PluginOptions): CacheEntry {
let key = `${inputFile}:${opts.base ?? ''}:${opts.optimize ?? ''}`
console.log('key:', key)
if (cache.has(key)) return cache.get(key)!
let entry = {
mtimes: new Map<string, number>(),
Expand Down