JSPM

react-classname-prefix-loader-with-lookup

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 90
  • Score
    100M100P100Q89688F
  • License MIT

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

Package Exports

  • react-classname-prefix-loader-with-lookup

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-classname-prefix-loader-with-lookup) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-classname-prefix-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-with-lookup --save-dev 

Usage

module: {
 loaders: [
  {
    test: /\.js$/,
    exclude: /node_modules/,
    use: [{
              loader: 'babel-loader'
           },
           {
              loader: path.resolve('react-classnames-prefix.js'),
              options:{
                prefix:'prefix-',
                fileName: ['./src/main.css','./src/style.css']
              }
    }]
  },
 ],
},

Recommendation

Credits

Plugin based on