Hi Guys,
So I am just need to break my styles out into separate files, here is the relevant section of my webpack config.
// https://github.com/halt-hammerzeit/webpack-isomorphic-tools
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
var webpackIsomorphicToolsPlugin = new WebpackIsomorphicToolsPlugin(require('./webpack-isomorphic-tools'));
var extractHeaderStyles = new ExtractTextPlugin('header.css');
var extractAllStyles = new ExtractTextPlugin('all.css');
var extractAppStyles = new ExtractTextPlugin('app.css');
//loaders
{ test: /\.scss$/, loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true') },
{ test: /App\.scss/, loader: extractAppStyles.extract('style', 'css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true') },
{ test: /Header\.scss/, loader: extractHeaderStyles.extract('style', 'css?modules&importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!sass?outputStyle=expanded&sourceMap=true&sourceMapContents=true') }
//plugins
extractHeaderStyles,
extractAppStyles
It all makes perfect sense, instantiate with file name, hand matched files, hand loader and it spits it out but its not working. Weirdly enough, the file is created (Header.css for example) but all of the styles are being stashed there.
I appear to still need the generic /.scss$ rule or files encountered error upon encountering an ‘@import’. I don’t really understand at this point, the documentation is not great, I am pretty sure this should be working