Tailwindcss: Delete unused CSS rules with purifycss

Created on 7 Nov 2017  路  4Comments  路  Source: tailwindlabs/tailwindcss

Hey, I think it can be a good idea to implement purifycss in the docs (and maybe in Tailwind default config?), when running npm run production to delete all unused CSS rules in a path? Because we'll never use all defined properties :)

Most helpful comment

Hey @adamwathan, I was really sad to see purifycss unmaintained...
So I decided to take over, fork and commit a fix, now we can use it with Tailwind 鉂わ笍

npm i -D purifycss-extended will solve all your problems :)

You can find the fork here: https://github.com/HapLifeMan/purifycss-extended!

Keep going 馃榿

All 4 comments

Unfortunately purifycss has a major bug that doesn't make it super useful with Tailwind, see here:

https://github.com/tailwindcss/discuss/issues/18#issuecomment-341572814

Hopefully they fix that one day; that would be great for our optimization story.

Here's a direct link to the issue on the purifycss repo:

https://github.com/purifycss/purifycss/issues/147

Gonna close this as addressed, thanks for bringing it up though!

Hey @adamwathan, I was really sad to see purifycss unmaintained...
So I decided to take over, fork and commit a fix, now we can use it with Tailwind 鉂わ笍

npm i -D purifycss-extended will solve all your problems :)

You can find the fork here: https://github.com/HapLifeMan/purifycss-extended!

Keep going 馃榿

Hey @adamwathan, the above package by @HapLifeMan works well via CLI but doesn't have a corresponding webpack plugin for Mix / webpack.

The author of PurgeCSS made some changes last night to work with Tailwind syntax. I feel that it's a little more flexible / robust than PurifyCSS.

I've written a post w/ some example gists at the top:

https://medium.com/@AndrewDelPrete/using-purifycss-to-remove-unused-tailwind-css-classes-173b3ee8ee01

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlexVipond picture AlexVipond  路  3Comments

afuno picture afuno  路  3Comments

lamberttraccard picture lamberttraccard  路  3Comments

rgaufman picture rgaufman  路  3Comments

Tjoosten picture Tjoosten  路  3Comments