Skip to content

What tool is being used to minify CSS and can it be configured? #2771

Answered by Theo-Steiner
cbergen asked this question in Q&A
Discussion options

You must be logged in to vote

Vite uses esbuild to minify css and javascript, so if you set minify: false this will also disable JS minification, as you noticed.
Vite does however expose a property called build.cssTarget, which allows you to set the (lowest) target platform your app cares about. → esbuild documentation
By default, this is set to esnext, which is probably why your css rules are unified (because the latest browsers all can handle this). Now I can't test this out for you, since I don't know which browser and which version doesn't support the merging of rules, but you can just give it a shot by setting the vite option of build.cssTarget. Let's hope esbuild knows that it shouldn't merge rules for the brows…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@benaltair
Comment options

@cbergen
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@cbergen
Comment options

Answer selected by cbergen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants