Put the Sprite importer on the default load paths coming from compass.

This commit is contained in:
Chris Eppstein 2010-11-29 14:35:37 -08:00
parent 28a77171e3
commit 5aac677e77
3 changed files with 13 additions and 1 deletions

View File

@ -22,6 +22,8 @@ module Compass
plugin_opts[:cache] = cache unless cache.nil? plugin_opts[:cache] = cache unless cache.nil?
plugin_opts[:cache_location] = cache_path unless cache_path.nil? plugin_opts[:cache_location] = cache_path unless cache_path.nil?
plugin_opts.merge!(sass_options || {}) plugin_opts.merge!(sass_options || {})
plugin_opts[:load_paths] ||= []
plugin_opts[:load_paths] << Compass::Sprites.new
plugin_opts plugin_opts
end end
@ -57,6 +59,7 @@ module Compass
load_paths << framework.stylesheets_directory if File.exists?(framework.stylesheets_directory) load_paths << framework.stylesheets_directory if File.exists?(framework.stylesheets_directory)
end end
load_paths += resolve_additional_import_paths load_paths += resolve_additional_import_paths
load_paths << Compass::Sprites.new
load_paths load_paths
end end
end end

View File

@ -102,6 +102,16 @@ module Compass
File.basename(uri)] File.basename(uri)]
end end
def mtime(uri, options)
Compass.quick_cache("mtime:#{uri}") do
self.path, self.name = Compass::Sprites.path_and_name(uri)
glob = File.join(Compass.configuration.images_path, uri)
Dir.glob(glob).inject(Time.at(0)) do |max_time, file|
(t = File.mtime(file)) > max_time ? t : max_time
end
end
end
def to_s def to_s
"" ""
end end

View File

@ -33,7 +33,6 @@ describe Compass::Sprites do
options[:line_comments] = false options[:line_comments] = false
options[:style] = :expanded options[:style] = :expanded
options[:syntax] = :scss options[:syntax] = :scss
options[:load_paths] << Compass::Sprites.new
css = Sass::Engine.new(scss, options).render css = Sass::Engine.new(scss, options).render
# reformat to fit result of heredoc: # reformat to fit result of heredoc:
" #{css.gsub('@charset "UTF-8";', '').gsub(/\n/, "\n ").strip}\n" " #{css.gsub('@charset "UTF-8";', '').gsub(/\n/, "\n ").strip}\n"