- “SASS” is also called as “Sassy CSS” and It stands for Syntactically Awesome Style Sheet.
- It is used for Authoring CSS.It provides an awesome programmatic platform to a CSS developer.
- To know more about SASS use the below link:-
- In this Demo,“We will learn Sass Installation in windows, configuring SCSS Watcher and creating a sample SCSS Rule file”.
- We need RUBY installed in our system to install SASS.To check ruby installation in your machine issue ruby with option -v.It will print the installed ruby version for your machine.Below screen shows this step,
- or you can download and install ruby from the below link,
- SASS is an RUBY based package(Gem) Issue gem command with install and sass as parameters.The below screen shows this step,
- Let’s create a basic java script project with two directory ‘sass‘ , ‘stylesheet‘ in our eclipse editor.Let’s create ‘my-style.scss’ file. to write all our sass based style rules.Also create a html file called ‘my-markup.html‘ for writing the HTML markups.Below screen shows the project structure,
- To run SASS Watcher issue the sass command with –watch option followed by source and target separated by colon.The watcher observes that there is a file called ‘my-style.scss’ inside the sass file and immediately creates a corresponding css file called ‘my-style.css’ inside the stylesheet directory.Watcher is responsible for maintaining sync between these two directories.The below screen shows the sass watcher start,
- In my-markup.html we have our HTML code which has a student details table.Also you can see the header part is calling my-style.css file.The code inside is as below,
<title>TS : SASS Watcher Demo</title>
<link rel='stylesheet' type="text/css" href='./stylesheet/my-style.css'>
- The my-style.scss file contains the sass code rule for our markup.you can see it is written in a different syntax and a structured way.The code inside this scss file is as below,
- While writing these codes inside my-style.scss file the sass watcher observes the changes and pick it up calls the sass compiler.The sass compiler then converts the sass code to ‘Abstract syntx tree’ object notation. From this notation it can be converted to css code inside ‘my-style.css’.You can observer the command prompt of the watcher below,
- Finally the css gets applied to our student table markup and output looks like below screen,