Created
July 20, 2018 21:14
-
-
Save majidzeno/45901f90051dd0b4e98288e5a4bba465 to your computer and use it in GitHub Desktop.
Configuring Sass With Create-react-app tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Create a new folder "styles" inside "src" folder | |
- create 2 folders inside styles "scss" & "css" | |
- move all the files of the starter project inside "scss" and rename their extension to be .scss | |
- edit "index.js" to get the correct url for the index.css file | |
- remove "App.css" from "App.js" file | |
- edit package.json "scripts" object | |
"build-css": "node-sass-chokidar --include-path ./src --include-path ./node_modules src/styles/scss/index.scss -o src/styles/css/", | |
"watch-css": "npm run build-css && node-sass-chokidar --include-path ./src --include-path ./node_modules src/styles/scss/index.scss -o src/styles/css/ --watch --recursive", | |
"start-js": "react-scripts start", | |
"start": "npm-run-all -p watch-css start-js", | |
"build-js": "react-scripts build", | |
"build": "npm-run-all build-css build-js" | |
- add App.scss to index.scss by @import "./App" | |
Happy Coding :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment