Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

execonline-inc/react-app-rewire-css-modules

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PLEASE DON'T USE THIS REPO. We are only going to keep this repo around long enough to upgrade to react-scripts v2 and then we'll delete it. If you use it in your app, you will wake up one day and it will be gone.

react-app-rewire-react-toolbox

Add CSS Module loaders to your create-react-app via react-app-rewired.

Installation

This package is not yet published to the npm registry. Install from GitHub:

yarn add --dev KaplanTestPrep/react-app-rewire-css-modules react-app-rewired

Example

In your package.json

  /* package.json */

  "scripts": {
-   "start": "react-scripts start",
+   "start": "react-app-rewired start",
-   "build": "react-scripts build",
+   "build": "react-app-rewired build",
-   "test": "react-scripts test --env=jsdom",
+   "test": "react-app-rewired test --env=jsdom"
}

In your react-app-rewired configuration:

/* config-overrides.js */
const rewireCssModules = require('react-app-rewire-css-modules');
const customProperties = {
  '--checkbox-color': 'purple',
  '--input-text-label-color': 'purple'
};

module.exports = function override(config, env, customProperties) {
  config = rewireCssModules(config, env, customProperties);
  return config;
};

In your React application:

// src/App.module.css

.input {
  color: aqua;
  
  &:hover {
    color: lawngreen;
  }
}
// src/App.js

import React from 'react';
import styles from './App.css';
import { Input } from '@abot/react-higgs/lib/input'; // Note: not from @abot/react-higgs/lib/input/Input
import inputTheme from './App.module.css';

export default ({text}) => (
    <div>
      <Input label="xxx" theme={inputTheme}/>
    </div>
)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published