【发布时间】:2014-11-09 22:20:43
【问题描述】:
我正在寻找一种通过检查本地文件并包含它来覆盖 compass config.rb 变量/常量的方法。 使用这种方法(而不是在调用 compass 时定义要使用的配置文件的当前选项)意味着我们可以为所有开发人员和构建系统设置一组默认值,并允许开发人员在必要时为他们自己的本地设置覆盖这些设置。 不幸的是,我根本不了解 Ruby,对文件的简单检查并在 config.rb 中要求它似乎并没有覆盖原始设置。我目前的编码尝试如下。请有人向我解释我在这里做错了什么?
config.rb
# Compass configuration file.
# Require any additional compass plugins here.
# Sass / Compass paths
http_path = "/"
css_dir = "../../web/stylesheets"
sass_dir = "sass"
images_dir = "../../web/images"
javascripts_dir = "javascript"
fonts_dir = "fonts"
# Output style environment can be forced on build using -e
output_style = (environment == :production) ? :compressed : :expanded
# To enable relative paths to assets via compass helper functions. Uncomment:
# relative_assets = true
# Disable the compass cache method - we use our own methods.
asset_cache_buster = :none
line_comments = false
color_output = false
preferred_syntax = :scss
# Define the location of a the compass / sass cache directory.
cache_path = "/tmp/compass-cache"
# Add shared sass path to make it easier to include assets.
add_import_path = "../shared/sass"
# TODO: Check for a local config file - use this to extend/override this config file.
$localConfig = File.join(File.dirname(__FILE__), "config.local.rb")
require $localConfig if File.exist?($localConfig) and File.file?($localConfig)
config.local.rb
# Additional custom Compass Configuration file.
# Require any additional compass plugins here.
line_comments = true
cache_path = "/Users/jwestbrook/Sites/compass-cache"
sass_options = {
:debug_info => true,
:sourcemap => true
}
enable_sourcemaps = true
【问题讨论】:
-
您找到解决方案了吗?
-
抱歉耽搁了@ojrask。最后,我确实在工作中与开发人员一起找到了解决方案。然而,代码与一个项目如此紧密地联系在一起,分开会很痛苦。不过,我将尝试整理一个简单的示例来向您展示我们所采取的方向。
标签: ruby compass-sass