purgecss icon indicating copy to clipboard operation
purgecss copied to clipboard

Ability to whitelist whole CSS files

Open dmt0 opened this issue 2 years ago • 14 comments

Is your feature request related to a problem? Please describe. I'm importing an NPM module that includes a CSS file. A lot of the classes in that file are caught by PurgeCSS.

Describe the solution you'd like A configuration option to whitelist entire files by path.

Describe alternatives you've considered

  • Fishing out classes one by one.
  • Adding all JS files from the NPM module to content - didn't work.

dmt0 avatar Jun 01 '22 01:06 dmt0

I was also looking for this! In my case the issue was that I want to exclude all Datatables (+ plugins) styles from the purging, as it would be impossible to manually find and safelist them one by one.

I also tried wrapping the imports like:

/* purgecss start ignore */
@import "~datatables.net/...";
/* purgecss end ignore */ 

But that also doesn't work 😢 Anybody has suggestions?

aleesaan avatar Jun 10 '22 12:06 aleesaan

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Sep 09 '22 00:09 github-actions[bot]

Bump

dmt0 avatar Sep 09 '22 14:09 dmt0

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Dec 09 '22 00:12 github-actions[bot]

I saw no negative feedback, so ... bump 🤷

dmt0 avatar Dec 09 '22 00:12 dmt0

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Mar 10 '23 00:03 github-actions[bot]

Not stale

aleesaan avatar Mar 10 '23 13:03 aleesaan

Hi @dmt0 and @aleesaan , have you any workaround solution for this I'm using next.js module css and don't want to remove them at all.

anoop0567 avatar May 03 '23 07:05 anoop0567

No workarounds so far. This package is unusable to me unfortunately.

dmt0 avatar May 03 '23 09:05 dmt0

No workarounds so far. This package is unusable to me unfortunately.

@dmt0 have you used any other package for the same functionality

anoop0567 avatar May 03 '23 09:05 anoop0567

I made it work, with Laravel 10 + Vite 4.4 + PurgeCss, with a workaround... First... /* purgecss start ignore */ didnt work at all, so i have to use /*! purgecss start ignore */ Second, it didnt work for me on full @import /*! purgecss start ignore */ @import 'datatables.net-dt/css/jquery.dataTables.css'; ... so... i copied the .css file to my resource dir, and include the start/stop inside the .css file, and then just import it @import 'jquery.dataTables-PurgeIgnored.css'; ...

aaronhernan avatar Aug 01 '23 01:08 aaronhernan

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Jan 29 '24 00:01 github-actions[bot]

bump

dmt0 avatar Jan 29 '24 01:01 dmt0