Skip to content

pedrogarciyalopez/react-app-rewire-postcss

This branch is up to date with ty2/react-app-rewire-postcss:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

f85b38b · Nov 21, 2020

History

10 Commits
Oct 9, 2018
Oct 13, 2018
Jun 5, 2018
Nov 21, 2020
Nov 21, 2020
May 13, 2019
May 13, 2019
Jun 5, 2018
Jun 5, 2018
Oct 13, 2018
Nov 21, 2020
Nov 21, 2020
Nov 21, 2020
Nov 21, 2020
Nov 21, 2020
Nov 21, 2020

Repository files navigation

React App Rewire PostCSS PostCSS Logo

NPM Version Build Status Support Chat

React App Rewire PostCSS lets you configure PostCSS in Create React App v1 and v2 without ejecting.

Usage

Add React App Rewire PostCSS to your Rewired React app:

npm install react-app-rewire-postcss --save-dev

Next, add React App Rewire PostCSS to config-overrides.js in your React app directory:

module.exports = config => {
  require('react-app-rewire-postcss')(config/*, options */);

  return config;
};

That’s it! Now you can control PostCSS with all the configuration options from PostCSS Loader:

module.exports = config => {
  require('react-app-rewire-postcss')(config, {
     plugins: loader => [
      require('postcss-preset-env')()
    ]
  });

  return config;
};

Alternatively, you can now use postcss.config.js in your React app directory:

module.exports = config => {
  require('react-app-rewire-postcss')(config, true /* any truthy value will do */);

  return config;
};
module.exports = {
  plugins: {
    'postcss-preset-env': {
      stage: 0
    }
  }
};

And you can leverage Browserslist by adding a .browserslistrc to your React app directory:

# browsers we support

> 2%
not dead

Happy PostCSS’ing!

About

Configure PostCSS in Create React App without ejecting

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 75.5%
  • HTML 17.0%
  • CSS 7.5%