CSS Wrap Loader for webpack.
Uses loader-utils.getOptions() to get the options, hence avoids any depreciation warnings related to parseQuery().
npm install wrap-css-loader --save-dev
module.exports = {
/* webpack config */
module: {
loaders: [{
test: /\.css$/,
loader: "wrap-css-loader",
options: {
selector: "namespace"
}
},
//other loaders
]},
}
module.exports = {
/* Webpack config */
module: {
loaders: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.(sass|scss)$/,
loader: ExtractTextPlugin.extract({
use: [
{
loader: "css-loader",
options: {
sourceMap: true
}
},
{
loader: "wrap-css-loader",
options: {
selector: config.namespace
}
},
{
loader: "sass-loader",
options: {
sourceMap: true
}
},
]
})
},
]},
plugins: [
new ExtractTextPlugin('[name].css'),
],
}