Skip to content

Commit

Permalink
Enable error recovery in Lightning CSS
Browse files Browse the repository at this point in the history
  • Loading branch information
thecrypticace committed Oct 3, 2023
1 parent 0d205f9 commit 09369d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module.exports = function tailwindcss(configOrPath) {
minify: false,
sourceMap: !!intermediateMap,
targets: lightningcss.browserslistToTargets(browserslist(browsersListConfig)),
errorRecovery: true,
drafts: {
customMedia: true,
},
Expand Down
21 changes: 10 additions & 11 deletions tests/arbitrary-values.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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-\[\{\}\] {
width: {
}
.w-full {
width: 100%;
}
.\[--custom\:\{\}\] {
--custom: {}
}
`)
})
Expand Down

0 comments on commit 09369d2

Please sign in to comment.