2024-10-01 17:00:20 +02:00
|
|
|
import { candidate, css, html, js, json, test } from '../utils'
|
|
|
|
|
|
|
|
|
|
test(
|
|
|
|
|
'production build',
|
|
|
|
|
{
|
|
|
|
|
fs: {
|
|
|
|
|
'package.json': json`
|
|
|
|
|
{
|
|
|
|
|
"dependencies": {
|
|
|
|
|
"postcss": "^8",
|
|
|
|
|
"postcss-cli": "^10",
|
|
|
|
|
"tailwindcss": "workspace:^",
|
|
|
|
|
"@tailwindcss/postcss": "workspace:^"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`,
|
|
|
|
|
'postcss.config.js': js`
|
|
|
|
|
module.exports = {
|
|
|
|
|
plugins: {
|
|
|
|
|
'@tailwindcss/postcss': {},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
`,
|
|
|
|
|
'index.html': html`
|
|
|
|
|
<div class="one:underline two:underline"></div>
|
|
|
|
|
`,
|
|
|
|
|
'src/shared.css': css`
|
2025-02-25 11:36:43 +01:00
|
|
|
@reference 'tailwindcss/theme';
|
2024-10-01 17:00:20 +02:00
|
|
|
@import 'tailwindcss/utilities';
|
|
|
|
|
`,
|
|
|
|
|
'src/root1.css': css`
|
|
|
|
|
@import './shared.css';
|
2025-01-21 10:20:35 -05:00
|
|
|
@custom-variant one (&:is([data-root='1']));
|
2024-10-01 17:00:20 +02:00
|
|
|
`,
|
|
|
|
|
'src/root2.css': css`
|
|
|
|
|
@import './shared.css';
|
2025-01-21 10:20:35 -05:00
|
|
|
@custom-variant two (&:is([data-root='2']));
|
2024-10-01 17:00:20 +02:00
|
|
|
`,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
async ({ fs, exec }) => {
|
|
|
|
|
await exec('pnpm postcss src/*.css -d dist')
|
|
|
|
|
|
|
|
|
|
await fs.expectFileToContain('dist/root1.css', [candidate`one:underline`])
|
|
|
|
|
await fs.expectFileNotToContain('dist/root1.css', [candidate`two:underline`])
|
|
|
|
|
|
|
|
|
|
await fs.expectFileNotToContain('dist/root2.css', [candidate`one:underline`])
|
|
|
|
|
await fs.expectFileToContain('dist/root2.css', [candidate`two:underline`])
|
|
|
|
|
},
|
|
|
|
|
)
|