Enter the command line in ruby to compile sass (ruby) and rubysass

Source: Internet
Author: User

Enter the command line in ruby to compile sass (ruby) and rubysass

Ruby(Or cmd) Enter the command line to compile sass as follows:

(1) For example: first, create a total folder under drive F, such as the test folder, and then create folders such as html, images, js, and sass under the folder.

(2) Create the sass file to be used in the sass folder. For example, common. scss, reset. scss, config. scss and other public files and various files to be used in the project. Of course, the files here can also be placed in different folders, but they are all subdirectories of the sass folder.

(3) The common. scss In the sass folder is as follows:

 1 /* 2 *created by Irene 3 *2016-04-20 4  */ 5 div{ 6     width: 300px; 7     height: 300px; 8     border: 1px solid #000; 9     background-color: #333;10     p{11         width: 200px;12         height: 200px;13         background-color: #666;14         a{15             display: inline-block;16             width: 100px;17             height: 100px;18             background-color: #999;19         }20     }21 }

(4) Start ruby and set the shortcut key (right-click ruby in the Start menu and select the shortcut key for Property setting). (I set Ctrl + Alt + Z ).

(5) enter the command line according to the steps.

The following structure is obtained:

 

(6) In this case, the command line does not clear the cache. Therefore, files and folders are generated as follows:

 

The following structure is obtained:

 

Therefore, it is best to include the -- no-cache command to clear the cache.

(7) If the sass folder contains multiple scss files, you must specify the file to be compiled. For the command, first find the directory of the sass file, and then convert a file in the sass folder to a file in the css folder.

 

The following structure is generated:

(8) problems found:

A. the sass folder must be created under the test folder, and ruby needs to identify the sass folder (I tried to Compile directly without the sass folder, but failed );

B. -- no-cache indicates clearing the cache, -- watch indicates listening commands, and -- style indicates style. compressed indicates compressing css files.

C. Several commands that can be compiled into different forms of css files

(Replace "compressed" in the Command "):

[1] nested: nested indent css code, which is the default value.

 1 /* 2 *created by Irene 3 *2016-04-20 4  */ 5 div { 6   width: 300px; 7   height: 300px; 8   border: 1px solid #000; 9   background-color: #333; }10   div p {11     width: 200px;12     height: 200px;13     background-color: #666; }14     div p a {15       display: inline-block;16       width: 100px;17       height: 100px;18       background-color: #999; }19 20 /*# sourceMappingURL=common.css.map */

[2] expanded: No indent, extended css code.

 1 /* 2 *created by Irene 3 *2016-04-20 4  */ 5 div { 6   width: 300px; 7   height: 300px; 8   border: 1px solid #000; 9   background-color: #333;10 }11 div p {12   width: 200px;13   height: 200px;14   background-color: #666;15 }16 div p a {17   display: inline-block;18   width: 100px;19   height: 100px;20   background-color: #999;21 }22 23 /*# sourceMappingURL=common.css.map */

[3] compact: css code in simple format.

1 /*2 *created by Irene3 *2016-04-20 */4 div { width: 300px; height: 300px; border: 1px solid #000; background-color: #333; }5 div p { width: 200px; height: 200px; background-color: #666; }6 div p a { display: inline-block; width: 100px; height: 100px; background-color: #999; }7 8 /*# sourceMappingURL=common.css.map */

[4] (or add this one, obsessive-compulsive disorder ...) Compressed: the compressed css code. (Compression is generally used in the production environment)

1 div{width:300px;height:300px;border:1px solid #000;background-color:#333}div p{width:200px;height:200px;background-color:#666}div p a{display:inline-block;width:100px;height:100px;background-color:#999}2 /*# sourceMappingURL=common.css.map */

(To myself: I understand this operation. It must be one-sided and not specific, but it will be improved step by step .)

 

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.