wrap-css-loader

CSS Wrap loader for webpack to wrap css classes with a namespace

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
wrap-css-loader
021.0.25 years ago5 years agoMinified + gzip package size for wrap-css-loader in KB

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
```javascript 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

```javascript 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'),
, } ```