项目作者: aze3ma

项目描述 :
Configure SASS in Create React App without ejecting
高级语言: JavaScript
项目地址: git://github.com/aze3ma/react-app-rewire-scss.git
创建时间: 2018-06-29T16:49:45Z
项目社区:https://github.com/aze3ma/react-app-rewire-scss

开源协议:MIT License

下载


Rewire create-react-app to use SASS!

You might not need this rewire, Create React App added guide about how to add Sass support to CRA without the need of ejecting,
but I just updated an existing deprecated package from react-app-rewired so in case you don’t like to locally watch your sass files this is the solution. See
Adding a CSS Preprocessor but in case you want to injecting Sass instead of the normal watch files approach CRA represnting using node-sass-chokidar

Install

  1. $ yarn add react-app-rewired react-app-rewire-scss -D
  2. $ npm install react-app-rewired react-app-rewire-scss --save-dev

Add it to your project

  1. const rewireSass = require('react-app-rewire-scss');
  2. /* config-overrides.js */
  3. module.exports = function override(config, env) {
  4. config = rewireSass(config, env);
  5. // with loaderOptions
  6. // config = rewireSass.withLoaderOptions(someLoaderOptions)(config, env);
  7. return config;
  8. }