Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PurgeCSS inline whitelist comments not working #76

Closed
hybridvision opened this issue Sep 4, 2019 · 3 comments
Closed

PurgeCSS inline whitelist comments not working #76

hybridvision opened this issue Sep 4, 2019 · 3 comments

Comments

@hybridvision
Copy link

Hello team Spatie! Thanks for creating this handy package :)

I just came across a problem that took me a while to figure out so I thought I'd share it here (and maybe there is something that can be done to make this smoother, even if it's just an extra note in the documentation).

A quick bit of background info: I was finding that some of the CSS I wrote to style 3rd party components (eg. MMenu) was being stripped out. Rather than trying to whitelist all the patterns, I saw in the PurgeCSS docs that you can whitelist CSS inline by adding special comments.

I tried adding /* purgecss start ignore */ and /* purgecss end ignore */ to my file but I found it wasn't working. Eventually I realised that these comments were being stripped before getting to PurgeCSS, so you have to add them like this instead (note the extra !):

/*! purgecss start ignore */

...

/*! purgecss end ignore */

These comments are left alone by Laravel Mix and then PurgeCSS removes them when it is done.

I don't know if there's anything that can be done to improve this but adjusting the ignore comments is a pretty simple fix. If only I'd known that an hour ago!

@mattstein
Copy link

Thank you for pointing this out, @hybridvision! Saved me an untold amount of head-scratching.

@hybridvision
Copy link
Author

I'm glad it helped you @mattstein!

@spatie-bot
Copy link

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants