react added sass

1. First, according to the official website sass, https: //www.sass.hk/install/, instructiongem install sass,一直安装不成功。

2. Because this is the create-react-app, the install so npm  sass-loader node-sass , in which node-sass not installed successfully

On the rule where you can

Find the config inside the two configuration files. 
Contents of the configuration are the same. 
Code: { 
Test: /\.scss$/, 
loaders to: [ 'style-Loader', 'CSS-Loader', 'Sass-Loader'], 
},

This configuration a bit, then write directly to a index.scss file, use the syntax scss on it, it can be used.

3.scss syntax, there have {};

$color:red;

.a{

  color:$color;

}

sass old grammar, syntax is not {} not; because they do not meet everyone's programming practice, so eliminated, grammar scss now used up

$color:red;

.a

  color:$color

 

 

Guess you like

Origin www.cnblogs.com/luziluck/p/11346771.html