Install
npm install css-selector-loader --save-dev
Usage
It's recommended to combine css-selector-loader
with the postcss-loader
file.css
component.js
fooElementstylecssText = ;barElementstylecssText = ;
webpack.config.js
module: rules: test: /\.css$/ use: loader: "css-selector-loader" loader: "postcss-loader"
Options
Name | Type | Default | Description |
---|---|---|---|
root |
{String} |
./ |
helps inline local url(...)'s as data-uri's |
camelCase |
{Boolean} |
true |
Enable/disable transfering css selectors into camel-case |
useVarTemplate |
{Boolean} |
true |
Enable/disable use function arguments to replace with css variables |
root
webpack.config.js
loader: 'css-selector-loader' options: root: path
camelCase
webpack.config.js
loader: 'css-selector-loader' options: camelCase: false
useVarTemplate
webpack.config.js
loader: 'css-selector-loader' options: useVarTemplate: false