![]() |
3 жил өмнө | |
---|---|---|
.. | ||
node_modules | 3 жил өмнө | |
LICENSE | 3 жил өмнө | |
README.md | 3 жил өмнө | |
index.js | 3 жил өмнө | |
package.json | 3 жил өмнө |
A Webpack plugin to optimize \ minimize CSS assets.
It will search for CSS assets during the Webpack build and will optimize \ minimize the CSS (by default it uses cssnano but a custom CSS processor can be specified).
Since extract-text-webpack-plugin only bundles (merges) text chunks, if its used to bundle CSS, the bundle might have duplicate entries (chunks can be duplicate free but when merged, duplicate CSS can be created).
Using npm:
$ npm install --save-dev optimize-css-assets-webpack-plugin
The plugin can receive the following options (all of them are optional):
/\.css$/g
{}
true
var OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin');
module.exports = {
module: {
loaders: [
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") }
]
},
plugins: [
new ExtractTextPlugin("styles.css"),
new OptimizeCssAssetsPlugin({
assetNameRegExp: /\.optimize\.css$/g,
cssProcessor: require('cssnano'),
cssProcessorOptions: { discardComments: {removeAll: true } },
canPrint: true
})
]
}