我正在尋找一種方法來通過檢查本地文件幷包括它來覆蓋指南針config.rb變量/常量。 使用此方法(而不是當前選擇調用指南針時要使用的配置文件)意味着我們可以爲所有開發人員創建一組默認設置並構建系統,並允許開發人員根據自己的本地設置重寫這些設置。 不幸的是,我根本不知道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
對不起@ojrask。我終於找到了一個解決方案,並與開發人員一起工作。但是,代碼與項目密切相關,否則將會很難分開。不過,我會嘗試整理一個簡單的例子來向你展示我們所採取的方向。 – jwestbrook