This is a basic Sass template to help starting new projects production.
In order to run Sass we have to install or update NodeJS an NPM (Node Packages Manager) to do that we run the following commands:
NodeJS Documentation
NPM (Node Packages Manager)
Since we have to install NodeJS and NPM it be a good thing to check if we doesn`t already have them install, we can do that with the following command:
$ node --version
$ npm --version
$ sudo npm cache clean -f
$ sudo npm install -g n
$ sudo n stable
$ sudo n latest
TO FIX PATH
$ sudo n rm version
$ sudo npm install -g n
First of all we will create a package.json file by running the following command:
$ sudo npm init -y
OBS: If by any chance you find out a Ubuntu permission ERROR while trying to save the package.json file try running the following command to solve it:
$ sudo chown -R $USER:$USER /home/
Then run:
$ sudo npm install node-sass
Once it is installed it will be showed in the package.json file.
In order to run node-sass we are going to create a NPM script to run it while we work on our project. We do that by removing the line containing the test and add the following script into package.json file:
"scripts": {
"sass": "node-sass -w scss/ -o dist/css/ --recursive"
}
Now we create two folders into projects root:
dist
|
img
index.html
scss
|
main.scss
To run node-sass we will use our npm script created earlier by running the following command:
$ npm run sass
Once it is running lets apply the following configuration to main.scss file so it can create our /css folder.
* {
box-sizing: border-box;
padding: 0;
margin: 0;
}
Once we save the file it will create a /css folder inside dist. Now we can start our project design.