Skip to content

Instantly share code, notes, and snippets.

@majidzeno
Created July 20, 2018 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save majidzeno/45901f90051dd0b4e98288e5a4bba465 to your computer and use it in GitHub Desktop.
Save majidzeno/45901f90051dd0b4e98288e5a4bba465 to your computer and use it in GitHub Desktop.
Configuring Sass With Create-react-app tool
- 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