Permalink
Browse files

Support older versions of tilt

  • Loading branch information...
1 parent 0b15aeb commit 1b4ce8a4487bdf9e778d8bfa499309897c97b270 @josh josh committed Apr 27, 2011
Showing with 7 additions and 5 deletions.
  1. +6 −4 lib/sprockets/engines.rb
  2. +1 −1 sprockets.gemspec
View
10 lib/sprockets/engines.rb
@@ -10,7 +10,7 @@ class Engines
def initialize(environment = nil)
@environment = environment
- @mappings = Tilt.mappings.dup
+ @mappings = {}
@pre_processors = [DirectiveProcessor]
@post_processors = []
@@ -35,18 +35,20 @@ def register(ext, klass)
@environment.extensions << ext
end
- @mappings[ext] << klass
+ @mappings[ext] = klass
end
alias_method :[]=, :register
def lookup(ext)
ext = ext.to_s.sub(/^\./, '').downcase
- @mappings[ext].first
+ @mappings[ext] || Tilt[ext]
end
alias_method :[], :lookup
def extensions
- @mappings.keys.map { |ext| ".#{ext}" }
+ exts = (Tilt.mappings.keys + @mappings.keys)
+ exts = exts.reject { |ext| ext == "" }.uniq.compact
+ exts.map { |ext| ".#{ext}" }
end
def concatenatable?(pathname)
View
2 sprockets.gemspec
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
s.add_dependency "hike", "~> 0.7"
s.add_dependency "rack", "~> 1.0"
- s.add_dependency "tilt", "~> 1.3"
+ s.add_dependency "tilt", "~> 1.0"
s.authors = ["Sam Stephenson", "Joshua Peek"]
s.email = "sstephenson@gmail.com"

0 comments on commit 1b4ce8a

Please sign in to comment.