43081j / postcss-lit

PostCSS syntax for extracting CSS from template literals inside JS/TS files
84 stars 6 forks source link

Basic usage question #48

Open pathofleastresistor opened 1 year ago

pathofleastresistor commented 1 year ago

I'm still learning the set of technologies here (e.g. lit, typescript, tailwind, and postcss) and I'm having trouble using this postcss plugin.

I checked in my sample code here - https://github.com/pathofleastresistor/postcss-lit-example.

I was expecting npm run build1 from my package.json to be what's needed to get your example working, but my main.js doesn't include the transformed css.

Did I miss something?

43081j commented 11 months ago

sorry this took me so long to get to, i've been away a lot this month and last.

this will be because the build output (main.js) actually ends up with different symbol names than in your source.

for example:

// source
css`.foo {}`;

// build output
(0, lit_1.css)`.foo {}`;

its a tough one to solve. you could either:

postcss-lit could only really get around this by supporting mangled/minified names, which feels like a bit of a rabbit hole