npm install node-sass-chokidar --save-dev
package.json添加两行:
1 "scripts": { 2 "build-css": "node-sass-chokidar src/ -o src/", 3 "watch-css": "npm run build-css && node-sass-chokidar src/ -o src/ --watch --recursive", 4 "start": "react-scripts start", 5 "build": "react-scripts build", 6 "test": "react-scripts test --env=jsdom",
运行 npm run watch-css 会将src目录下的scss转换成css