Skip to content

Commit 09369d2

Browse files
committed
Enable error recovery in Lightning CSS
1 parent 0d205f9 commit 09369d2

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/plugin.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ module.exports = function tailwindcss(configOrPath) {
6666
minify: false,
6767
sourceMap: !!intermediateMap,
6868
targets: lightningcss.browserslistToTargets(browserslist(browsersListConfig)),
69+
errorRecovery: true,
6970
drafts: {
7071
customMedia: true,
7172
},

tests/arbitrary-values.test.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,25 @@ test('arbitrary values', () => {
1818
// before it generated invalid CSS without throwing an error.
1919
//
2020
// In perfect world, we would not generate anything, and potentially show a warning.
21-
test.skip('arbitrary values that result in invalid CSS should not be generated', () => {
21+
test('arbitrary values that result in invalid CSS should not be generated', () => {
2222
let config = {
2323
content: [
2424
{
25-
raw: html`<div class="w-[{}] w-[{{}}]"></div>`,
25+
raw: html`<div class="w-full w-[{}] w-[{{}}] [--custom:{}]"></div>`,
2626
},
2727
],
2828
}
2929

30+
// NOTE: The version with braces are invalid and therefore produce nothing
3031
return run('@tailwind utilities', config).then((result) => {
32+
// Required because it tries to reformat the {}
33+
// prettier-ignore
3134
return expect(result.css).toMatchFormattedCss(css`
32-
.w-\[\{\{\}\}\] {
33-
width: {
34-
{
35-
}
36-
}
37-
}
38-
.w-\[\{\}\] {
39-
width: {
40-
}
35+
.w-full {
36+
width: 100%;
37+
}
38+
.\[--custom\:\{\}\] {
39+
--custom: {}
4140
}
4241
`)
4342
})

0 commit comments

Comments
 (0)