Last active
July 10, 2018 10:51
-
-
Save phun-ky/766e5ec9f75eac61c945273a951f0c0b to your computer and use it in GitHub Desktop.
webpack + postcss + extract-text-plugin = no CSS duplicates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
postcss: () => { | |
return [ | |
cssnano({ | |
reduceIdents: false, | |
discardDuplicates: true, | |
autoprefixer: true | |
}) | |
]; | |
},modules: { | |
loaders: [{ | |
test: test_expressions.css, | |
loader: extractTextPlugin.extract('css-loader?importLoaders=1!postcss-loader') | |
},{ | |
test: test_expressions.stylus, | |
loader: extractTextPlugin.extract('css-loader?importLoaders=2!postcss-loader!stylus-loader') | |
}] | |
}, | |
plugins: [ | |
new extractTextPlugin('[name].css'), | |
new OptimizeCssAssetsPlugin({ | |
assetNameRegExp: /\.css$/ | |
}) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to use this in dev, you will have to use a plugin like
write-file-webpack-plugin
to force webpack to write the file to disk in dev.