Created
April 18, 2017 15:22
-
-
Save barraponto/d7b1ed410f5ec7ccb574e40fd21faf39 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
| module.exports = (neutrino, options) => { | |
| // Supports neutrino-preset-web and any other preset following this pattern. | |
| const styleRule = neutrino.config.module.rule('style'); | |
| const styleTest = styleRule.get('test'); | |
| const styleFallback = styleRule && styleRule.use('style'); | |
| const styleLoaders = styleRule && styleRule.uses.store.keys() | |
| .filter((key) => key !== 'style') | |
| .map((key) => stylerule.use(key)) | |
| .map((use) => ({loader: use.loader, options: use.options})); | |
| const loaders = ExtractTextPlugin.extract({ | |
| fallback: options.fallback || styleFallback|| 'style-loader', | |
| use: options.use || styleLoaders || 'css-loader', | |
| }); | |
| loaders.forEach((loader, options) => console.log([loader, options])); | |
| neutrino.config.plugin('extract') | |
| .use(ExtractTextPlugin, [options.filename || '[name].css']); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment