Open a-0-dev opened 1 year ago
Also experienced this now working in Svelte with Tailwind, set the style tag lang to "postcss" so I can use tailwind directives, and now I have a bunch of diagnostics for every css selector I haven't used in this file
it almost seems like svelte preprocess runs after postcss plugins, because even adding cssnano
does nothing to remove these (unused)
comments.
I'm starting to use svelte-preprocess with webpack and tailwindcss. When running the dev server, warnings about unused CSS selectors appear, such as the following one:
The problem is that one of these warnings appears for EVREY selector (~1500 lines of warnings), and of course there is also the warning overlay in the dev server's website view.
Technically, the combination Svelte+Webpack+TypeScript+TailwindCSS is already working for me (styling is applied etc.), it's just this mess of warnings that is a problem.
I could not yet find any explanation or fix on the internet, both because most documentation is for
rollup
, and because thepostcss
option forsveltePreprocess
does not seem to have an option for purging unused CSS - at least I couldn't find anything.If you need any more info on config files etc. I'm happy to provide them.
Excerpt from webpack.config.js:
Whole tailwind.config.js: