Difference between uncss and purifycss

3.1k Views Asked by At

I'm already using uncss with grunt, but stumbled upon purifycss.

I can't seem to find comparisons anywhere.

Can anyone tell me the difference between the two to help me choose the right one?

2

There are 2 best solutions below

0
On

UnCSS removes unused CSS from your stylesheets.

PurifyCSS does not modify the original CSS files.

I use PurifyCSS and I full recommend.

I hope that simplify the things for you, everyone has a way to do the things. If I were you I would test both and see which one is more helpful for you.

EDIT: PurifyCSS takes also care about JS-Files which could add CSS classes and IDs.

3
On

Here is a more recent comparison, courtesy of another similar project, purgecss: https://www.purgecss.com/comparison.html


Summary

PurifyCSS

  • Works with any file type, not just HTML or JS
  • Uses extractors, which takes the content of a file and extracts the list of CSS selectors used in it

UnCSS

  • Effective at removing unused selectors from web apps due to HTML emulation and JS execution.
    • This has a performance cost.
  • Most accurate tool if you don't use server-side rendering.
  • No extractor for JS files, but developers can create extractors for specific frameworks and file types.