2

我将编译后的 .css 文件放在应用程序中的多个不同目录中,而我之前使用的 Sass 编译器只是将 .scss 文件编译为它们所在目录中的 .css 文件。

Compass 似乎需要一个您可以配置的“输出”目录,所有已编译的 .css 文件都会转到该目录,并且它只监视一个文件夹。

你如何告诉 Compass 简单地编译到 .scss 文件的位置?

4

2 回答 2

1

愚蠢的我(当时)。指南针也这样做。只需为您的项目选择最高的父文件夹作为文件中的sasscssdirs config.rb,compass 将递归循环并将 css 编译到它找到的任何目录中的 sass 中。

sass_options = {:cache_location => "./temp/.sass-cache"}
http_path = "/"
css_dir = "therootdirectory"
sass_dir = "therootdirectory"
images_dir = "therootdirectory/assets/images/sprites"
javascripts_dir = "javascripts"
于 2014-11-21T16:39:56.313 回答
1

Compass 使用一个名为config.rb. 用户可以在其中设置资产的各种路径、输出的样式以及 CSS 输出的路径。

Compass 网站上的文档:http: //compass-style.org/help/tutorials/configuration-reference/

这是我通常用于项目的示例,它将我的 CSS 编译到与 SCSS 不同的位置。如果您希望它位于同一个位置,您可以使用路径(单个句点),它会告诉它编译到与您使用命令行.的目录相同的目录中。watch

# Set this to the root of your project when deployed:
http_path = "/www/"
sass_dir = "sass"
images_dir = "../www/lib/cssimgages"
javascripts_dir = "../www/lib/js"
fonts_dir = "../www/lib/fonts"
css_dir = "../www/lib/css"

# You can select your preferred output style here (can be overridden via the command line):
# output_style = :expanded or :nested or :compact or :compressed
output_style = :compact

不过,我确实同意其他一些评论。您的 HTTP 请求应尽可能低,可能仅引用一个样式表用于移动优先样式,另一个样式表用于媒体查询中的样式。但这并不能回答你的问题。

于 2013-09-10T03:21:12.470 回答