Tailwind 1.4 - Setup with PurgeCSS [Guide] #1697
Replies: 3 comments 3 replies
-
Thanks for this compilation. however i'm wondering what is the difference here?
|
Beta Was this translation helpful? Give feedback.
-
Do you know how you can add minification to the build setup? I tried adding
The output has the unused classes removed, however it's not minified. I'm guessing I need to set it up in a different way. This is my
And this is my
Any ideas? |
Beta Was this translation helpful? Give feedback.
-
minor update for updated versions of tailwind: U must install "postcss" too as your dependency before running "npm run build" as shown here: https://youtu.be/21HuwjmuS7A?t=279 So, first run "npm install postcss" then follow along with that video. |
Beta Was this translation helpful? Give feedback.
-
Here a little guide (or a note to my future self).
Step 1 - Setup Tailwind and PurgeCSS
tailwind.config.js
like this: https://tailwindcss.com/docs/controlling-file-size/#removing-unused-cssStep 2 - Environmental setup
npm install --save-dev cross-env
.package.json
file add aproduction
row like this:Step 3 - Run Tailwind with PurgeCSS
Additional notes
purge
configuration intailwind.config.js
and NOTpostcss.config.js
. I pick the wrong file sometimes.cross-env
allows forNODE_ENV
to be run "inline", in thepackage.json
script call.tailwind.min.css
, but it's not actually minified, only smaller. Call it something else if you like.Beta Was this translation helpful? Give feedback.
All reactions