react-classname-prefix-loader-with-lookup

1.0.5 • Public • Published

react-classname-prefix-loader-with-lookup

A Webpack loader that prefixes classes with custom prefix in React components. You can use lookup css files and if class presents then only it will update with prefix.

MyComponent.js

class MyComponent extends React.Component {
  render () {
    return <div className='myclass'></div>
  }
}
 
export default MyComponent

Output:

class MyComponent extends React.Component {
  render () {
    return <div className='your_prefix-myclass'></div>
  }
}
 
export default MyComponent

Also works with classnames module!

Installation

$ npm install react-classname-prefix-loader-with-lookup --save-dev 

Usage

module: {
 loaders: [
  {
    test: /\.js$/,
    exclude: /node_modules/,
    use: [{
              loader: 'babel-loader'
           },
           {
              loader: 'react-classname-prefix-loader-with-lookup',
              options:{
                prefix:'prefix-',
                fileName: ['./src/main.css','./src/style.css']
              }
    }]
  },
 ],
},

Recommendation

Credits

Plugin based on

Readme

Keywords

Package Sidebar

Install

npm i react-classname-prefix-loader-with-lookup

Weekly Downloads

29

Version

1.0.5

License

MIT

Unpacked Size

8.03 kB

Total Files

4

Last publish

Collaborators

  • nagendertank