Next.js Discord

Discord Forum

Tailwind minification

Unanswered
Brewer's Blackbird posted this in #help-forum
Open in Discord
Brewer's BlackbirdOP
I'm preparing an app for production and noticed that our tailwind classes aren't minified. I was working under the assumption that minification would come for free using nextjs. I went looking for options and production nextjs sites like leerob.io arent minifying tailwind, nor are others like the boilerplates on github.
I tried using cssnano with postcss, but that failed due to an error with nextjs fonts.
Does anyone have any example next configs / other files which minify tailwind in production on vercel?

4 Replies

Toyger
why do you want to minify it?
if you host it on vercel or configured your server correctly it anyway gzipped, and in that state it will be insignificant difference between minified/original response.
Brewer's BlackbirdOP
I was getting confused, I am used to minifiers not just minifying css, but optimising the classNames used in the final js output. Turns out next is minifying the css, but doesn't mangle class names.
@Brewer's Blackbird I was getting confused, I am used to minifiers not just minifying css, but optimising the classNames used in the final js output. Turns out next is minifying the css, but doesn't mangle class names.
Toyger
if you want to make it for faster site loads it will not help, because gzip will make it approximately same size as if it was minified names.
but if you want to obfuscate classnames then you probably need to come up with some custom solution, I don't sure such thing exist that will do it in whole project.
Brewer's BlackbirdOP
Ok, thanks, appreciate the insight