jekyll-assets icon indicating copy to clipboard operation
jekyll-assets copied to clipboard

Support removing unused css

Open xu-cheng opened this issue 6 years ago • 2 comments

Hi, thanks for this awesome tool.

This is a feature request. If by any chance, would you consider to support removing unused css in the pipeline? This can be beneficial as it dramatically reduces the size of the assets and helps to boost website loading speed.

There are some existing tools which you can integrate into jekyll-assets to support such feature:

  • https://github.com/purifycss/purifycss
  • https://github.com/giakki/uncss
  • https://github.com/FullHuman/purgecss

All of them have a command line interface.

xu-cheng avatar Jan 29 '18 06:01 xu-cheng

If I am not mistaking this article should have all of the relevant code:

https://cobwwweb.com/use-purge-css-to-optimize-jekyll

ddebernardy avatar Aug 16 '18 18:08 ddebernardy

I'd be surprised if that code works reliably, since Jekyll-Asset's is fully asynchronous, so relying on Jekyll to determine when Jekyll-Assets has completed is gonna race sometime, especially if you rely on a large set of assets, or have slow bound IO.

https://github.com/envygeeks/jekyll-assets#hooks

envygeeks avatar Aug 16 '18 19:08 envygeeks