Skip to main content

Sass Usage

You can use SASS in three different ways:

  • As a command line tool
  • As a Ruby module
  • As a plugin for Rack enable framework

The following table shows the commands, which are used for executing the SASS code:

CommandDescription
sass input.scss output.cssIt is used to run the SASS code from the command line.
sass --watch input.scss:output.cssIt informs SASS to watch the file and update the CSS whenever SASS file changes.
sass --watch app/sass:public/stylesheetsIt is used to watch the entire directory, if SASS contains many files in a directory.

Syntax Selection

You can determine which syntax you are using in the SASS template by using the SASS command line tool. By default, SASS uses indented syntax which is an alternative to CSS based SCSS syntax. You can use the SCSS command line program, which is similar to the SASS program, but by the default, it considers the syntax to be SCSS.

Encodings

SASS uses the character encoding of stylesheets by specifying the following CSS specifications:

  • First, it checks for Unicode byte, next @charset declaration and then Ruby string encoding.
  • Next, if nothing is set, then it considers charset encoding as UTF-8.
  • Determine character encoding explicitly by using @charset declaration. Just use "@charset encoding name" at the beginning of the stylesheet and SASS will assume that this is the given character encoding.
  • If output file of SASS contains non-ASCII characters, then it will use the @charset declaration.

Table of Contents