我的应用程序中的多个不同目录中都有已编译的 .css 文件,而我之前使用的 Sass 编译器只是将 .scss 文件编译为它们所在目录中的 .css 文件。
Compass 似乎需要一个您可以配置的“输出”目录,所有已编译的 .css 文件都将进入该目录,并且它只监视一个文件夹。
如何告诉 Compass 简单地编译到 .scss 文件的位置?
最佳答案
Compass 使用名为 config.rb
的 ruby 配置文件。用户可以在其中设置各种资源路径、输出样式以及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 请求应保持尽可能低,可能仅引用一个用于移动优先样式的样式表,另一个用于媒体查询中的样式。但这并不能回答你的问题。
关于css - compass 将 .css 输出路径设置为与 .scss 相同的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18665437/