简体   繁体   English

使用指南针将scss文件编译为不同的css

[英]Use compass to compile scss file to a different css

I had a doubt regarding compiling the scss file using compass. 我对使用罗盘编译scss文件有疑问。 For example I have 2 directories, 1 for Sass and another 1 for my CSS files. 例如,我有2个目录,1个用于Sass,另外1个用于我的CSS文件。 In my css directory, I have 2 CSS files... "xuvs.css" and "site.css".... 在我的css目录中,我有2个CSS文件...“xuvs.css”和“site.css”....

If I make changes in the "xuvs.scss" file, so during the final compilation, by default Compass applies the changes to "xuvs.css"... So is it possible to apply those changes in the "site.css" instead of "xuvs.css" file using compass? 如果我在“xuvs.scss”文件中进行更改,那么在最终编译期间,默认情况下Compass会将更改应用于“xuvs.css”...那么是否可以在“site.css”中应用这些更改使用指南针的“xuvs.css”文件?

By default, Sass and Compass will output .css files for any matching .scss files that are not prefixed with an underscore. 默认情况下,Sass和Compass将输出任何匹配的.scss文件的.css文件,这些文件没有前缀的下划线。 This is why your "css" directory contains the two compiled files: one for each of your .scss files. 这就是为什么你的“css”目录包含两个编译文件的原因:每个.scss文件一个。

It is possible to modify xuvs.scss and have it compile into site.css : you would do this via the @import rule , however, unless you changed the file name of xuvs.scss to _xuvs.scss , you would still have a separate, compiled file named xuvs.css . 它可以修改xuvs.scss ,并把它编译成site.css :你想通过做这个@import规则然而,除非你改变的文件名xuvs.scss_xuvs.scss ,你仍然有一个单独的,编译文件名为xuvs.css Files that are prefixed with an underscore are called partials . 以下划线为前缀的文件称为partials

It is considered a "best practice" to create partials and @import them into a single, compiled "base" .scss file. 它被认为是“最佳实践”创造谐音和@import成一个单一的,编制了“基地” .scss文件。 In your case, this compiled file would be called site.css . 在您的情况下,此编译文件将被称为site.css

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM