Skip to content

A Webpack loader that prefixes classes with custom prefix in React components

License

Notifications You must be signed in to change notification settings

vezetvsem/react-classname-prefix-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-classname-prefix-loader

A Webpack loader that prefixes classes with custom prefix in React components

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 --save-dev 

Usage

module: {
 loaders: [
  {
    test: /\.js$/,
    exclude: /node_modules/,
    loaders: ['react-hot', 'babel-loader', 'react-classname-prefix-loader?prefix=your_prefix'],
  },
 ],
},

Recommendation

About

A Webpack loader that prefixes classes with custom prefix in React components

Resources

License

Stars

Watchers

Forks

Packages

No packages published