react-classnamePrefix-loader
A Webpack loader that prefixes classes with custom prefix in React components
This loader is an improvement over vezetvsem/react-classname-prefix-loader
install
via npm
npm install react-cnpl --save-dev
via yarn
yarn add react-cnpl --dev
Very simple configuration module loader example:
... module: loaders: ... test: /\.jsx$/ exclude: /node_modules/ loader: "react-cnpl" query: prefixname:'<prefixname>--' ...
Example
Component { return <div ="block"> <div ="block inner"> <h1 ="block inner title___">Title</h1> </div> </div> ; }
output will be
Title
ignore : Object
ignoring classNames and elements
... module: loaders: ... test: /\.jsx$/ exclude: /node_modules/ loader: "react-cnpl" query: prefixname:'<prefixname>--' ignore: // ignoring elements using array elements:'div''pre''i' // ignoring classname using array className:'x''y''z' ...
Recommendation
postcss-class-prefix for css files!!