Set Up Your Next Web Dev Project with SCSS Made Easy!
Tags: scss, css, webdev, beginners
Published: 2021-06-30 23:21:59

If you are anything like me, sometimes vanilla CSS just doesn't cut it. I mostly use SCSS for it's organizational purposes. 

Here, I will walk you through the pretty simple steps of how to set up SCSS for your next project! This article will just help you on how to set up SCSS / SASS in your project. If you would like to learn more on how to use SCSS / SASS and what it can do, you can check out the official SASS Guide [Here](https://sass-lang.com/guide).

If you don't care about the in depth explanations, check out the TLDR; section at the bottom!

I have a folder structure that seems to work pretty well for me. In any given project folder, I will have a `dist` folder that holds my index.html, image files, and any JavaScript files I may have. This is considered my distribution file, and if someone wanted to deploy the website, they could just use that folder to deploy without all that extra SCSS stuff to get in the way.

### Creating your project folders
Let's start off by creating a project folder for yourself. 
1. Create a folder for your project.
2. Within that folder, create another folder labeled `dist`. You can name it whatever you want, but this is the name I use.
3. Also within your project folder, create another one called `scss`. This will house all of your SCSS files.
It should look a little something like this: 
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ltwj0q98024oyhdpaonc.png)
 

4. Next step is installing node.js...

### Installing Node and SASS
Before we get started with SCSS, you will need Node on your machine. To get node, you can go to [Node's Website Here](https://nodejs.org/en/download/) and follow the instructions for your device. 
5. Once node is installed, open your terminal.
1. To validate that you have node installed, run the command `node --version`. You should see a version number returned.
3. Now we will globally install SASS. To do this, run the command `npm install -g sass`. This will install it globally on your machine.

### Code all your SCSS to your heart's content
Here is where you can get creative and code your SCSS files! Have fun with it!

### Compiling your SCSS
Alright, now let's see what you did!

1. Within your terminal, you can navigate to your file path. 
  * To do this, you can type in `cd <filepath>`. So if your project was on your desktop, you can do `cd \desktop\my_project` and you will be brought to your project.
2. Enter the command `sass /scss/main.scss dist/css/main.css`. This will build and compile your SCSS files. Just run that command every time you want to compile!
3. Just refresh your project, and BOOM! It's updated!

### How I Use SCSS
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oiv0u2yanf7io1b3nu4d.png)
I use SCSS for organization. You can see how I am using this in one of my real projects I am working on. Within the SCSS folder, I use the `main.scss` file as a file that holds imports to all other scss files. I then break down each section of the website into it's own scss file. So you can see in the above screenshot, I have a file specifically for the Hero of the page.

### TLDR;
I know I was wordy up there, you can find a simple numbered list here on how to set it up.

1. Create your project folder
2. Within project folder, create a `dist` folder
3. Within the project folder, create an `scss` folder
4. Install [Node.js](https://nodejs.org/en/download) if you have not already.
5. In your terminal, run the command `npm install -g sass` to install SASS globally.
6. Navigate to your project within your terminal.
7. Code your SCSS with all your might!
* When you are ready to compile your SCSS files, you can enter the command `sass /scss/main.scss dist/css/main.css`. This will build and compile your SCSS files. Just run that command every time you want to compile!

Congratulations, you are now up and running with SASS! Happy Coding!