- Install dependencies
npm install --save webpack extract-text-webpack-plugin
- Make the changes specified in the files here
| var ExtractTextPlugin = require("extract-text-webpack-plugin"); | |
| module.exports = function(config, env) { | |
| if(env === 'static') { | |
| config.removeLoader('css'); | |
| config.loader('css', function(cfg) { | |
| cfg.test = /\.css$/; | |
| cfg.loader = ExtractTextPlugin.extract('css?minimize'); | |
| return cfg | |
| }) | |
| config.plugin('extract-css', | |
| ExtractTextPlugin, | |
| ["styles.css", { allChunks: true }]); | |
| } | |
| return config; | |
| } |
| import './what.css'; | |
| ... | |
| <link rel="stylesheet" type="text/css" href='/styles.css'/> |
npm install --save webpack extract-text-webpack-plugin
| body { | |
| background: pink; | |
| } |