postcss-purgecss wrapper with sensible defaults for Laravel apps
npm install postcss-purgecss-laravelpostcss-purgecss wrapper with sensible defaults for Laravel apps


A simple wrapper around postcss-purgecss with sensible defaults for Laravel apps.
``js
// postcss.config.js
module.exports = {
plugins: [
require('postcss-purgecss-laravel')({
whitelistPatterns: [/hljs/],
extend: {
content: [content: [path.join(__dirname, 'vendor/spatie/menu/*/.php')],]
},
});
],
};
`

We invest a lot of resources into creating best in class open source packages. You can support us by buying one of our paid products.
We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on our contact page. We publish all received postcards on our virtual postcard wall.
You can install the package with yarn or npm:
`bash`
yarn add postcss-purgecss-laravel --dev
`bash`
npm install postcss-purgecss-laravel --save-dev
Register the PostCSS plugin.
`js
// postcss.config.js
module.exports = {
plugins: [
require('postcss-purgecss-laravel')(/ ... /);
]
}
`
All options passed to the plugin get passed down to PurgeCSS. Refer to the PurgeCSS docs for an overview of the available options.
`js
// postcss.config.js
module.exports = {
plugins: [
require('postcss-purgecss-laravel')({
whitelistPatterns: [/hljs/],
}),
],
};
`
Options will _override_ the default options this package provides. If you'd rather _extend_ the options, place them in the extend option.
`js
// postcss.config.js
module.exports = {
plugins: [
require('postcss-purgecss-laravel')({
extend: {
whitelistPatterns: [/hljs/],
},
}),
],
};
`
In the above example, the /hljs/ pattern will be _added_ to the whitelistPatterns, instead of overriding the default whitelistPatterns option.
These are the defaults this package provides:
`js``
const defaultConfig = {
content: [
"app/*/.php",
"resources/*/.html",
"resources/*/.js",
"resources/*/.jsx",
"resources/*/.ts",
"resources/*/.tsx",
"resources/*/.php",
"resources/*/.vue",
"resources/*/.twig",
],
defaultExtractor: (content) => content.match(/[\w-/.:]+(? whitelistPatterns: [/-active$/, /-enter$/, /-leave-to$/, /show$/],
};
Please see CHANGELOG for more information what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email freek@spatie.be instead of using the issue tracker.
- Sebastian De Deyne
- All Contributors
The MIT License (MIT). Please see License File for more information.