purgecss-loader

Purgecss loader for webpack
This Webpack loader uses purgecss
to strip unused selectors from your CSS.
Installation
npm install -D @americanexpress/purgecss-loader
Usage
Configure as follows:
module.exports = {
entry: {...},
output: {...},
module: {
rules: [
{
test: /\.css$/,
use: [
{
loader: 'css-loader',
options: {
modules: true,
localIdentName: '[name]__[local]___[hash:base64:5]',
},
},
{
loader: '@americanexpress/purgecss-loader',
options: {
paths: [path.join(somePath, 'src/**/*.{js,jsx}')],
},
},
],
},
],
},
}
You should use this with the css-loader
as seen above. However, it is not required that you use CSS modules. That is in
the example to express this loader's compatibility.
Options
Contributing
We welcome Your interest in the American Express Open Source Community on Github.
Any Contributor to any Open Source Project managed by the American Express Open
Source Community must accept and sign an Agreement indicating agreement to the
terms below. Except for the rights granted in this Agreement to American Express
and to recipients of software distributed by American Express, You reserve all
right, title, and interest, if any, in and to Your Contributions. Please fill
out the Agreement.
Please feel free to open pull requests and see CONTRIBUTING.md
for commit formatting details.
License
Any contributions made under this project will be governed by the
Apache License 2.0.
Code of Conduct
This project adheres to the American Express Community Guidelines.
By participating, you are expected to honor these guidelines.