我正在寻找一种通过检查本地文件并包含它来覆盖指南针 config.rb 变量/常量的方法。使用这种方法(而不是在调用 compass 时定义要使用的配置文件的当前选项)意味着我们可以为所有开发人员和构建系统设置一组默认值,并允许开发人员在必要时为他们自己的本地设置覆盖这些设置。不幸的是,我根本不了解 Ruby,对文件的简单检查并在 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)
配置.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