Add SASS documentation
See original GitHub issueAdding SASS (or Less) support in a project bootstrapped using create-react-app, doesn’t require any advanced modifications. It’s seems more intimidating than it actually is. We don’t even have to eject.
First, install preprocessor of your choice. SASS seems the most popular weapon of choice at the moment, so we’ll use it as an example:
npm install node-sass --save-dev
Then in package.json
just add the following lines:
"scripts": {
...
"build-css": "node-sass src/sass/base.scss src/index.css",
"watch-css": "node-sass src/sass/base.scss src/index.css -w",
...
}
and run them alongside main scripts, by adding npm run watch-css &
to start
script and npm run build-css &&
to build
.
"scripts": {
"start": "npm run watch-css & react-scripts start",
"build": "npm run build-css && react-scripts build",
"build-css": "node-sass src/sass/base.scss src/index.css",
"watch-css": "node-sass src/sass/base.scss src/index.css -w",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
As far as I’m concerned, that works using Less as well.
Is that something that would belong in current documentation?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:41
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Documentation - Sass
Sass is a stylesheet language that's compiled to CSS. It allows you to use variables, nested rules, mixins, functions, and more, all with...
Read more >Sass Basics
Once Sass is installed, you can compile your Sass to CSS using the sass command. You'll need to tell Sass which file to...
Read more >Install Sass
You can install Sass on Windows, Mac, or Linux by downloading the package for your operating system from GitHub and adding it to...
Read more >Sass: @import
Sass extends CSS's @import rule with the ability to import Sass and CSS stylesheets, providing access to mixins, functions, and variables and combining ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any news on this? I found a way to store all scss files in some folder and export them in other:
-w
is used for watch,-o
is used for output. This will export individual files (scss -> css) into corresponding directory. Would be nice to include this somehow into webpack CSS bundle.Such problem came when you change your node version.Use following command and serve the application on browser. npm rebuild node-sass --force