Table of Contents
Adding Sass is one of the first things most developers do when starting an application. Writing in plain CSS can be done, but Sass provides much more power with features like:
- And More
Add Sass to Create React App using a single line: yarn add node-sass
For the official docs, check out the Create React App guide.
The steps to add Sass to Create React App are:
- Install node-sass:
yarn add node-sass
- Convert your
- Import your
.scssfiles in your React components like
Here's a deeper dive. In order to add Sass to a Create React App application, we need a single command:
# using npm npm install node-sass --save # using yarn yarn add node-sass
Once you have that, we can rename our
App.js file, we can import the Sass file using the
Once we restart our
yarn start command, we can see that our Sass file is imported!
Create React App allows us to extend it with a quick command!
Like this article? Follow @chrisoncode on Twitter