spatie / laravel-mix-purgecss

Zero-config Purgecss for Laravel Mix
https://spatie.be/en/opensource
MIT License
874 stars 38 forks source link

Whitelist classes #83

Closed RahulDey12 closed 4 years ago

RahulDey12 commented 4 years ago

how can I whitelist this class :not(.layout-fixed) .main-sidebar

sebastiandedeyne commented 4 years ago

For a complex selector like this, you're probably best off with inline Purgecss ignore comments.


/* purgecss start ignore */
:not(.layout-fixed) .main-sidebar {
  /* ... */
}
/* purgecss end ignore */
RahulDey12 commented 4 years ago

But it is coming from vendor stylesheet

sebastiandedeyne commented 4 years ago

In that case, you'll need to add a whitelist pattern. Check out Purgecss' whitelisting docs.

https://purgecss.com/whitelisting.html#specific-selectors

mix.purgeCss({
  whitelist: ['main-sidebar']
})
saraElsanan commented 4 years ago

i tried this but it doesn't work ... the weird thing that it select some classes and ignore others , for example .iti-flag.eg it ignores it , but .iti-flag.ca it magically appears correct , which doesn't make any sense , I also tried to use /iti-flag*/ , /iti-flag$/ , /$iti-flag/ and still got this weird issue . Any help please

In that case, you'll need to add a whitelist pattern. Check out Purgecss' whitelisting docs.

https://purgecss.com/whitelisting.html#specific-selectors

mix.purgeCss({
  whitelist: ['main-sidebar']
})
saraElsanan commented 4 years ago

For a complex selector like this, you're probably best off with inline Purgecss ignore comments.

/* purgecss start ignore */
:not(.layout-fixed) .main-sidebar {
  /* ... */
}
/* purgecss end ignore */

this solution also doesn't work with @import '~vue-tel-input/dist/vue-tel-input.css'; :( Any help Please

sebastiandedeyne commented 4 years ago

Sorry, this repo is just a wrapper for Purgecss. If you're having issues with Purgecss usage, you'll need to open an issue at https://github.com/FullHuman/purgecss.

saraElsanan commented 4 years ago

Sorry, this repo is just a wrapper for Purgecss. If you're having issues with Purgecss usage, you'll need to open an issue at https://github.com/FullHuman/purgecss.

okay thanks