Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
Ensure engine registry is setup on require sprockets
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Oct 11, 2011
1 parent b5817f6 commit 67df578
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
24 changes: 24 additions & 0 deletions lib/sprockets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,28 @@ module Sprockets
module Cache
autoload :FileStore, "sprockets/cache/file_store"
end

# Extend Sprockets module to provide global registry
extend Engines
@engines = {}

# Cherry pick the default Tilt engines that make sense for
# Sprockets. We don't need ones that only generate html like HAML.

# Mmm, CoffeeScript
register_engine '.coffee', Tilt::CoffeeScriptTemplate

# JST engines
register_engine '.jst', JstProcessor
register_engine '.eco', EcoTemplate
register_engine '.ejs', EjsTemplate

# CSS engines
register_engine '.less', Tilt::LessTemplate
register_engine '.sass', Tilt::SassTemplate
register_engine '.scss', Tilt::ScssTemplate

# Other
register_engine '.erb', Tilt::ERBTemplate
register_engine '.str', Tilt::StringTemplate
end
24 changes: 0 additions & 24 deletions lib/sprockets/engines.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,4 @@ def deep_copy_hash(hash)
hash.inject(initial) { |h, (k, a)| h[k] = a.dup; h }
end
end

# Extend Sprockets module to provide global registry
extend Engines
@engines = {}

# Cherry pick the default Tilt engines that make sense for
# Sprockets. We don't need ones that only generate html like HAML.

# Mmm, CoffeeScript
register_engine '.coffee', Tilt::CoffeeScriptTemplate

# JST engines
register_engine '.jst', JstProcessor
register_engine '.eco', EcoTemplate
register_engine '.ejs', EjsTemplate

# CSS engines
register_engine '.less', Tilt::LessTemplate
register_engine '.sass', Tilt::SassTemplate
register_engine '.scss', Tilt::ScssTemplate

# Other
register_engine '.erb', Tilt::ERBTemplate
register_engine '.str', Tilt::StringTemplate
end

0 comments on commit 67df578

Please sign in to comment.