7

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?

rmoestl
  • 3,059
  • 5
  • 24
  • 38
Louis Philippe
  • 177
  • 1
  • 10

2 Answers2

9

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.

raduken
  • 2,091
  • 16
  • 67
  • 105
3

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.
Colin Strong
  • 118
  • 1
  • 9
  • 2
    There are some errors in this summary. Extractors are part of Purgecss. – Ffloriel May 31 '18 at 22:10
  • @Ffloriel can you elaborate please? The summary states that PurifyCSS uses extractors. – Colin Strong Jun 01 '18 at 14:42
  • 1
    Yes, sorry for the lack of precision. Purifycss considers all files to be the same. They are not treated differently. When purifycss comes across a js file, it will look at the files and consider every word a potential css selector. It will do the same for a file .html, .pug, .blade, etc... With Purifycss, you can't change this behavior. You can consider that Purifycss has 1 extractor that can't be replaced or customized. – Ffloriel Jun 13 '18 at 07:04