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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Here a little guide (or a note to my future self).
Step 1 - Setup Tailwind and PurgeCSS
tailwind.config.jslike this: https://tailwindcss.com/docs/controlling-file-size/#removing-unused-cssStep 2 - Environmental setup
npm install --save-dev cross-env.package.jsonfile add aproductionrow like this:Step 3 - Run Tailwind with PurgeCSS
Additional notes
purgeconfiguration intailwind.config.jsand NOTpostcss.config.js. I pick the wrong file sometimes.cross-envallows forNODE_ENVto be run "inline", in thepackage.jsonscript 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