Skip to content

Instantly share code, notes, and snippets.

Last active July 10, 2018 10:51
  • Star 9 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
webpack + postcss + extract-text-plugin = no CSS duplicates
postcss: () => {
return [
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$/
Copy link

phun-ky commented Jan 16, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment