Permalink
Browse files

Only set those compass configuration options that have been explicitl…

…y set by the user.


Closes GH-21.
  • Loading branch information...
1 parent 6201548 commit 40cc1b8e0d1c9236e2ec83c05295b938687ce27e @chriseppstein chriseppstein committed Mar 11, 2012
Showing with 22 additions and 2 deletions.
  1. +22 −2 lib/compass-rails.rb
View
@@ -177,8 +177,18 @@ def initialize!(config = nil)
def configure_rails!(app)
return unless app.config.respond_to?(:sass)
- app.config.compass.to_sass_engine_options.each do |key, value|
- app.config.sass.send(:"#{key}=", value)
+ sass_config = app.config.sass
+ compass_config = app.config.compass
+
+ sass_config.load_paths.concat(compass_config.sass_load_paths)
+
+ { :output_style => :style,
+ :line_comments => :line_comments,
+ :cache => :cache,
+ :disable_warnings => :quiet,
+ :preferred_syntax => :preferred_syntax
+ }.each do |compass_option, sass_option|
+ set_maybe sass_config, compass_config, sass_option, compass_option
end
end
@@ -198,6 +208,16 @@ def asset_pipeline_enabled?
rails_config.respond_to?(:assets) && rails_config.assets.try(:enabled)
end
+ private
+
+ # sets the sass config value only if the corresponding compass-based setting
+ # has been explicitly set by the user.
+ def set_maybe(sass_config, compass_config, sass_option, compass_option)
+ if compass_value = compass_config.send(:"#{compass_option}_without_default")
+ sass_config.send(:"#{sass_option}=", compass_value)
+ end
+ end
+
end
Compass::AppIntegration.register(:rails, "::CompassRails")

0 comments on commit 40cc1b8

Please sign in to comment.