Better rails boot sequence for compass that is both rails and compass command line friendly.
This commit is contained in:
parent
f425075978
commit
ae4daa2572
@ -111,8 +111,10 @@ module Compass
|
|||||||
if respond_to?("comment_for_#{prop}")
|
if respond_to?("comment_for_#{prop}")
|
||||||
contents << send("comment_for_#{prop}")
|
contents << send("comment_for_#{prop}")
|
||||||
end
|
end
|
||||||
unless value.nil?
|
if block_given? && (to_emit = yield(prop, value))
|
||||||
contents << %Q(#{prop} = #{value.inspect}\n)
|
contents << to_emit
|
||||||
|
else
|
||||||
|
contents << %Q(#{prop} = #{value.inspect}\n) unless value.nil?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
contents
|
contents
|
||||||
|
@ -4,7 +4,7 @@ module Compass
|
|||||||
class RailsInstaller < Base
|
class RailsInstaller < Base
|
||||||
|
|
||||||
def configure
|
def configure
|
||||||
configuration_file = targetize('config/initializers/compass.rb')
|
configuration_file = targetize('config/compass.config')
|
||||||
if File.exists?(configuration_file)
|
if File.exists?(configuration_file)
|
||||||
open(configuration_file) do |config|
|
open(configuration_file) do |config|
|
||||||
eval(config.read, nil, configuration_file)
|
eval(config.read, nil, configuration_file)
|
||||||
@ -20,6 +20,11 @@ module Compass
|
|||||||
end
|
end
|
||||||
|
|
||||||
def prepare
|
def prepare
|
||||||
|
write_file(targetize('config/compass.config'), Compass.configuration.serialize do |prop, value|
|
||||||
|
if prop == :project_path
|
||||||
|
"project_path = RAILS_ROOT if defined?(RAILS_ROOT)\n"
|
||||||
|
end
|
||||||
|
end)
|
||||||
write_file targetize('config/initializers/compass.rb'), initializer_contents
|
write_file targetize('config/initializers/compass.rb'), initializer_contents
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -81,11 +86,7 @@ Emit compiled stylesheets to #{recommended_location}/? (Y/n) }
|
|||||||
def initializer_contents
|
def initializer_contents
|
||||||
%Q{require 'compass'
|
%Q{require 'compass'
|
||||||
# If you have any compass plugins, require them here.
|
# If you have any compass plugins, require them here.
|
||||||
Compass.configuration do |config|
|
Compass.configuration.parse(File.join(RAILS_ROOT, "config", "compass.config"))
|
||||||
config.project_path = RAILS_ROOT
|
|
||||||
config.sass_dir = "#{sass_dir}"
|
|
||||||
config.css_dir = "#{css_dir}"
|
|
||||||
end
|
|
||||||
Compass.configure_sass_plugin!
|
Compass.configure_sass_plugin!
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user