minify-html-literals
minify-html-literals copied to clipboard
splitHTMLByPlaceholder fails only if using "unsafeCSS"
Hello! I'm using the minify-html-literals-loader
in my webpack setup, and basically it throws an error only if I use unsafeCSS
inside the styles e.g.
return css`
:host([type=${unsafeCSS(SomeType.One)}]) {
color: red;
}
`
The error is
Error: splitHTMLByPlaceholder() must return same number of strings as template parts
at Object.ensureHTMLPartsValid (....\node_modules\minify-html-literals\src\minifyHTMLLiterals.js:60:19)
at ....\node_modules\minify-html-literals\src\minifyHTMLLiterals.js:121:26
at Array.forEach (<anonymous>)
at minifyHTMLLiterals (....\node_modules\minify-html-literals\src\minifyHTMLLiterals.js:93:15)
at module.exports (....\node_modules\minify-html-literals-loader\index.js:7:20)
Does it really matter if you use unsafeCSS
or just the bare variable in the expression?
I get this error anytime there is a nested expression, and there's no way to ignore and just have minify abort. Setting validate: false
makes no difference.