A clean-css loader for webpack.
clean-css-loader
![npm clean-css-loader](https://img.shields.io/npm/dm/clean-css-loader.svg)
Getting Started
To begin, you'll need to install clean-css-loader:
yarn add -D clean-css-loader
Then add the plugin to your webpack config. For example:
const isProduction = process.env.NODE_ENV === "production";
module.exports = {
module: {
rules: [
{
test: /\.css$/,
use: [
"style-loader",
"css-loader",
{
loader: "clean-css-loader",
options: {
disable: !isProduction,
skipWarn: false,
compatibility: "ie9",
level: 2,
inline: ["remote"],
},
},
],
},
],
},
};
Or using plugin inline:
import "style-loader!css-loader!clean-css-loader!./style.css";
import "style-loader!css-loader!clean-css-loader?level=2!./style.css";
Options
disable: boolean
This option enables/disables minify, useful to easily disable on development mode (default: false
)
skipWarn: boolean
This option enables/disables output warnings (default: false
)
sourceMap: boolean
Enables/Disables generation of source maps. (default: compiler.devtool
)
CleanCSS
module options