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

Last updated on December 20, 2021

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.