react-app-rewire-css-modules-simple

1.0.0 • Public • Published

react-app-rewire-css-modules-simple npm

Add CSS Module loaders to your create-react-app via react-app-rewired. Simple, without SASS or LESS.

Installation

npm install --save-dev react-app-rewire-css-modules-simple

Usage

Use the following file extensions for any css module styles:

  • *.module.css

Example

In your react-app-rewired configuration:

/* config-overrides.js */
 
const rewireCssModules = require("react-app-rewire-css-modules-simple");
 
module.exports = function override(config, env) {
  
  config = rewireCssModules(config, env);
  
  // with loaderOptions
  config = rewireCssModules.withLoaderOptions({
    localIdentName: '[local]___[hash:base64:5]',
  })(config, env);
 
  return config;
};

In your React application:

/* App.module.css */
 
.div {
  color: red;
}
// App.js
 
import React from 'react';
import styles from './App.module.css';
 
export default ({text}) => (
    <div className={styles.div}>{text}</div>
)

Package Sidebar

Install

npm i react-app-rewire-css-modules-simple

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.47 kB

Total Files

4

Last publish

Collaborators

  • jackyr