wrap-css-loader
v1.0.2
Published
CSS Wrap loader for webpack to wrap css classes with a namespace
Downloads
3,802
Maintainers
Readme
wrap-css-loader
CSS Wrap Loader for webpack
Uses loader-utils.getOptions() to get the options, hence avoids any depreciation warnings related to parseQuery()
Install
npm install wrap-css-loader --save-dev
Usage
Basic Usage
module.exports = {
/* webpack config */
module: {
loaders: [{
test: /\.css$/,
loader: "wrap-css-loader",
options: {
selector: "namespace"
}
},
//other loaders
]},
}
Example with a typical webpack config using babel-loader, sass-loader and extract text plugin
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'),
],
}