A, install,

SASS is written in Ruby, and you must install Ruby before you install SASS. Ruby installation address: rubyinstaller.org/downloads/ after installation, we can perform the following command to see whether the installation is successful:

ruby -v
Copy the code

If the following information is displayed, the installation is successful:

Next, install sass:

gem install sass
Copy the code

You will notice that the current folder has an extra folder, and you can start using it.

Second, the use of

Next create a project folder,

SASS files are plain text files where CSS syntax can be used directly. The file name extension is. SCSS, which means Sassy CSS.

#index.css:


$font-zise:14px;
$color:#F90;
.box{
	background:$color;
}
 compress
Copy the code

The following command can be displayed on the screen. SCSS file converted CSS code.

sass sass/index.scss
Copy the code

SASS provides four options for compilation styles:

Nested: nested indented CSS code, which is the default.

* expanded: Unindented, expanded CSS code.

* Compact: CSS code in compact format.

* compressed: Compressed CSS code.

In production environments, the last option is typically used.

    sass --style compressed sass/index.scss css/index.css
Copy the code

Then you’ll notice that THERE’s an index. CSS folder in the CSS folder I just created

Add the index.css file to index