Enable error recovery in Lightning CSS

This commit is contained in:
Jordan Pittman 2023-10-03 13:04:17 -04:00
parent 0d205f9376
commit 09369d27ec
2 changed files with 10 additions and 10 deletions

View file

@ -66,6 +66,7 @@ module.exports = function tailwindcss(configOrPath) {
minify: false,
sourceMap: !!intermediateMap,
targets: lightningcss.browserslistToTargets(browserslist(browsersListConfig)),
errorRecovery: true,
drafts: {
customMedia: true,
},

View file

@ -18,26 +18,25 @@ test('arbitrary values', () => {
// before it generated invalid CSS without throwing an error.
//
// In perfect world, we would not generate anything, and potentially show a warning.
test.skip('arbitrary values that result in invalid CSS should not be generated', () => {
test('arbitrary values that result in invalid CSS should not be generated', () => {
let config = {
content: [
{
raw: html`<div class="w-[{}] w-[{{}}]"></div>`,
raw: html`<div class="w-full w-[{}] w-[{{}}] [--custom:{}]"></div>`,
},
],
}
// NOTE: The version with braces are invalid and therefore produce nothing
return run('@tailwind utilities', config).then((result) => {
// Required because it tries to reformat the {}
// prettier-ignore
return expect(result.css).toMatchFormattedCss(css`
.w-\[\{\{\}\}\] {
width: {
{
}
}
.w-full {
width: 100%;
}
.w-\[\{\}\] {
width: {
}
.\[--custom\:\{\}\] {
--custom: {}
}
`)
})