nuxt-purgecss icon indicating copy to clipboard operation
nuxt-purgecss copied to clipboard

Support for special comments

Open gendalf opened this issue 5 years ago • 5 comments

Is there are any way to keep analyze special whitelist comments before it will strip?

https://github.com/FullHuman/purgecss-docs/blob/master/whitelisting.md

/* purgecss ignore */

/* purgecss start ignore */

gendalf avatar Jun 08 '19 17:06 gendalf

This module is using purgecss under the hood, so it should be already possible :relaxed:

TheAlexLichter avatar Jun 10 '19 18:06 TheAlexLichter

This doesn't seem to be working as expected. I added /* purgecss start ignore */ to the top of main.css and /* purgecss end ignore */ to the bottom, but the CSS still never makes it in.

andrewrynhard avatar Nov 12 '19 04:11 andrewrynhard

I'm having the same issue. Css inside of a /* purgecss start ignore / and / purgecss end ignore */ are being purged from production bundle. (When I use npm run dev the styles are good, but npm run generate results in those styles being missing). Not sure if this is an issue with this moule, nuxt, or some other module I'm using (like maybe the comments are being stripped before it ever gets to purge)??

danielkellyio avatar Dec 27 '19 05:12 danielkellyio

Just confirming, this is still the case

avblink avatar Mar 11 '21 13:03 avblink

In webpack we need to add ! to the comment:

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

But it only works with these comments. not others.

avblink avatar Mar 11 '21 15:03 avblink

Resolved via linked PR

TheAlexLichter avatar Sep 30 '22 17:09 TheAlexLichter