rollup-plugin-postcss-lit
rollup-plugin-postcss-lit copied to clipboard
Invalid CSS produced with Vite 3 when using a base path
The original issue was created in https://github.com/vitejs/vite/issues/9694
With Vite 3 the CSS in JS can be of the type
const a = 'foo '+someJS + 'bar';
in practice it is used for calculating relative URLs
When the string is wrapped by this plugin, it is changed to a format where the JS is no longer executed and you end up with something like this in the final CSS
@font-face{font-family:Line Awesome Brands;font-style:normal;font-weight:400;font-display:auto;src:url("+new URL('la-brands-400.c0e32387.eot', import.meta.url).href+");
Not sure if the escaping can be fixed or worked around here or if this needs to be fixed in Vite