Automatic compiling sass tutorials in ruby environments _ruby topics

Source: Internet
Author: User

Sass for the CSS to give the characteristics of dynamic language, such as variables, inheritance, operations, functions, etc., more convenient for the writing and maintenance of CSS!

Sass Installation

Because SASS relies on the ruby environment, make sure Ruby is installed before installing SASS. Install Ruby http://www.jb51.net/article/61501.htm

After installing Ruby, in the Start menu, locate the ruby that we just installed, open the start Command Prompt with Ruby

And then enter directly into the command line

Copy Code code as follows:

Gem Install Sass

Press ENTER to confirm, wait a period of time will prompt you sass installs successfully.

The command detection installation is complete enough:

If you want to install a beta version of, you can enter at the command line

Copy Code code as follows:

Gem Install sass--pre

Using SASS

Sass files are plain text files that can be used directly in CSS syntax. The file suffix name is. scss, meaning sassy CSS.

The following command allows you to display the CSS code for the. scss file transformation on the screen. (Suppose the file name is test.) )

Copy Code code as follows:

Sass Test.scss

If you want to save the displayed results to a file, follow a. css file name.

Copy Code code as follows:

Sass Test.scss Test.css

SASS offers four compilation-style options:

Copy Code code as follows:

* Nested: Nested indented CSS code, which is the default value.
* Expanded: No indented, extended CSS code.
* Compact: Concise format CSS code.
* Compressed: Compressed CSS code.

In a production environment, the last option is generally used.

Copy Code code as follows:

Sass--style Compressed Test.sass test.css

You can also have Sass monitor a file or directory and automatically generate the compiled version once the source file has changed.

Copy Code code as follows:

Listening for files
Sass--watch Input.scss:output.css
Listening folders
Sass--watch App/sass:public/stylesheets

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.