SASS - Introduction

Copyright Notice: Copyright, without permission prohibited reproduced! https://blog.csdn.net/weixin_43031412/article/details/91126051


Sass CSS is a language extension, it makes it easier to write CSS maintenance. Sass is an abbreviation Syntactically Awesome StyleSheets (syntax great style sheet), and is particularly useful for a large number of CSS code project.

Sass work is written Sass source code file, then the program Sass (Sass compiler / translator) to convert it to the CSS file.

As can be seen, which is similar to c language, c developers to write code in the source file, an executable file is then generated by the compiler.

image

So you do not directly modify the css file, but modify Sass source file.

Sass CSS code similar to the code, but also a few more things, such as variable, mixed character, mathematical operators, and so on.

For example, you can define a variable color, in a plurality of selectors, to avoid duplication of the same color value is written in a plurality of selectors, simply modify the value of a variable modified it.

To use Sass, first install the program Sass, Sass program is a compiler / translator, the main role is to compile as sass css, Sass running on Ruby, so Ruby also need to be installed.

SASS program use

SASS program There are three ways:

  • As a command-line tool
  • As a separate module Ruby
  • Rack-enabled for any frame (including Ruby on Rails and Merb) plug

Code written in SASS

Sass support full CSS syntax, as well as the expansion of a group called SassScript. SassScript property allows the use of variables, and arithmetic functions. SassScript be used for any attribute value, it can also be used to select and dynamically generate attribute names.

Sass advantage

Sass main advantages:

  • It helps keep large stylesheets well-organized
  • Providing extension to the CSS, such as variables, functions, and nested mixed
  • CSS helps developers to quickly develop

Guess you like

Origin blog.csdn.net/weixin_43031412/article/details/91126051