[Rails] Fix a setup bug and handle compass configuration changes at rails boot.
Existing rails projects should change their compass initializer file to: require 'compass' rails_root = (defined?(Rails) ? Rails.root : RAILS_ROOT).to_s Compass.add_project_configuration(File.join(rails_root, "config", "compass.rb")) Compass.configure_sass_plugin! Compass.handle_configuration_change!
This commit is contained in:
parent
c1b903024f
commit
8172fce22a
@ -20,6 +20,12 @@ module Compass
|
||||
extend(ConfigurationDefaults)
|
||||
end
|
||||
|
||||
def env
|
||||
if rails_env = (defined?(::Rails) ? ::Rails.env : (defined?(RAILS_ENV) ? RAILS_ENV : nil))
|
||||
rails_env.production? ? :production : :development
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -80,9 +80,12 @@ module Compass
|
||||
end
|
||||
|
||||
def config_contents
|
||||
"# This configuration file works with both the Compass command line tool and within Rails.\n" +
|
||||
Compass.configuration.serialize do |prop, value|
|
||||
if prop == :project_path
|
||||
"project_path = RAILS_ROOT if defined?(RAILS_ROOT)\n"
|
||||
elsif prop == :environment
|
||||
"environment = Compass::AppIntegration::Rails.env\n"
|
||||
elsif prop == :output_style
|
||||
""
|
||||
end
|
||||
@ -91,11 +94,11 @@ module Compass
|
||||
|
||||
def initializer_contents
|
||||
%Q{require 'compass'
|
||||
# If you have any compass plugins, require them here.
|
||||
Compass.configuration.parse(File.join(RAILS_ROOT, "config", "compass.rb"))
|
||||
Compass.configuration.environment = (defined?(Rails) ? Rails.env : RAILS_ENV).to_sym
|
||||
Compass.configure_sass_plugin!
|
||||
}
|
||||
|rails_root = (defined?(Rails) ? Rails.root : RAILS_ROOT).to_s
|
||||
|Compass.add_project_configuration(File.join(rails_root, "config", "compass.rb"))
|
||||
|Compass.configure_sass_plugin!
|
||||
|Compass.handle_configuration_change!
|
||||
|}.gsub(/^\s+\|/,'')
|
||||
end
|
||||
|
||||
def stylesheet_prefix
|
||||
|
@ -145,13 +145,17 @@ module Compass
|
||||
end
|
||||
end
|
||||
|
||||
def debug
|
||||
def chain
|
||||
instances = [self]
|
||||
instances << instances.last.inherited_data while instances.last.inherited_data
|
||||
instances
|
||||
end
|
||||
|
||||
def debug
|
||||
normalized_attrs = {}
|
||||
ATTRIBUTES.each do |prop|
|
||||
values = []
|
||||
instances.each do |instance|
|
||||
chain.each do |instance|
|
||||
values << {
|
||||
:raw => (instance.send("raw_#{prop}") rescue nil),
|
||||
:value => (instance.send("#{prop}_without_default") rescue nil),
|
||||
|
@ -73,7 +73,7 @@ module Compass
|
||||
def serialize_property(prop, value)
|
||||
%Q(#{prop} = #{value.inspect}\n)
|
||||
end
|
||||
|
||||
|
||||
def issue_deprecation_warnings
|
||||
if http_images_path == :relative
|
||||
$stderr.puts "DEPRECATION WARNING: Please set relative_assets = true to enable relative paths."
|
||||
|
Loading…
Reference in New Issue
Block a user