[Extensions] When installing a file, the :like option can now be set to have it installed into the same location as what it is like.
This commit is contained in:
parent
6555ab3952
commit
21cfce33db
@ -31,7 +31,7 @@ module Compass
|
|||||||
# Initializes the project to work with compass
|
# Initializes the project to work with compass
|
||||||
def init
|
def init
|
||||||
dirs = manifest.map do |entry|
|
dirs = manifest.map do |entry|
|
||||||
File.dirname(send("install_location_for_#{entry.type}", entry.to))
|
File.dirname(send("install_location_for_#{entry.type}", entry.to, entry.options))
|
||||||
end
|
end
|
||||||
|
|
||||||
if manifest.has_stylesheet?
|
if manifest.has_stylesheet?
|
||||||
@ -90,9 +90,16 @@ module Compass
|
|||||||
def self.installer(type, &locator)
|
def self.installer(type, &locator)
|
||||||
locator ||= lambda{|to| to}
|
locator ||= lambda{|to| to}
|
||||||
loc_method = "install_location_for_#{type}".to_sym
|
loc_method = "install_location_for_#{type}".to_sym
|
||||||
define_method loc_method, locator
|
define_method("simple_#{loc_method}", locator)
|
||||||
|
define_method(loc_method) do |to, options|
|
||||||
|
if options[:like] && options[:like] != type
|
||||||
|
send("install_location_for_#{options[:like]}", to, options)
|
||||||
|
else
|
||||||
|
send("simple_#{loc_method}", to)
|
||||||
|
end
|
||||||
|
end
|
||||||
define_method "install_#{type}" do |from, to, options|
|
define_method "install_#{type}" do |from, to, options|
|
||||||
copy templatize(from), targetize(send(loc_method, to))
|
copy templatize(from), targetize(send(loc_method, to, options))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -100,6 +107,10 @@ module Compass
|
|||||||
"#{sass_dir}/#{pattern_name_as_dir}#{to}"
|
"#{sass_dir}/#{pattern_name_as_dir}#{to}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
installer :css do |to|
|
||||||
|
"#{css_dir}/#{to}"
|
||||||
|
end
|
||||||
|
|
||||||
installer :image do |to|
|
installer :image do |to|
|
||||||
"#{images_dir}/#{to}"
|
"#{images_dir}/#{to}"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user