Inject @config "..." when a tailwind.config.{js,ts,...} is detected (#14635)

This PR injects a `@config "…"` in the CSS file if a JS based config has
been found.

We will try to inject the `@config` in a sensible place:
1. Above the very first `@theme`
2. If that doesn't work, below the last `@import`
3. If that doesn't work, at the top of the file (as a last resort)
This commit is contained in:
Robin Malfait 2024-10-10 16:02:42 +02:00 • committed by GitHub
parent 4d1becd2f9
commit fb1731a2de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 292 additions and 15 deletions

View file

@ -330,7 +330,8 @@ export function test(
return a[0].localeCompare(z[0])
})
.map(([file, content]) => `--- ${file} ---\n${content || '<EMPTY>'}`)
.join('\n\n')}`
.join('\n\n')
.trim()}\n`
},
async expectFileToContain(filePath, contents) {
return retryAssertion(async () => {