Skip to content

Instantly share code, notes, and snippets.

@gavindoughtie
Created December 22, 2016 21:46
Show Gist options
  • Save gavindoughtie/12f867d1d6bb7477b478f1673ce19663 to your computer and use it in GitHub Desktop.
Save gavindoughtie/12f867d1d6bb7477b478f1673ce19663 to your computer and use it in GitHub Desktop.
parts.js extractCSS attempt for Webpack2
exports.extractCSS = function(paths) {
return {
module: {
rules: [
// Extract CSS during build
{
test: /\.css$/,
include: paths,
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
loader: [{loader: 'css-loader', query: { modules: true, importLoaders: 2 }}]
})
}
],
},
plugins: [
// Output extracted CSS to a file
new ExtractTextPlugin({
filename: '[name].[chunkhash].css',
disable: false,
allChunks: true
})
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment