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

Last updated on September 1, 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.

Happy purging!

Invite us to your inbox.

Articles, guides and interviews about web development and career progression.

Max 1-2x times per month.