What to do if purgeCSS is purging code inside an ignore block

Published in February 2020

After hours of wondering why my CSS was still being purged even though it was inside /* purge start ignore */ and /* purgecss end ignore /*, I discovered a simple answer on Github that I wanted to share.

Add ! so your ignore comments look like this

/*! purgecss start ignore */
/*! purgecss end ignore */

This removes any comments in and around rules, selectors & declarations. But comments marked with ! are kept by default.

Enjoy purging!

Level up your web development skills

Get articles, guides and interviews right in your inbox. Join a community of fellow developers.

No spam. Unsubscribe at any time.

Full Stack Heroes logo

© 2020 Full Stack Heroes