Skip to content
This repository
Browse code

Ensure engine registry is setup on require sprockets

  • Loading branch information...
commit 67df578673fab407780ba701e1b7f28516ae7d4e 1 parent b5817f6
Joshua Peek josh authored

Showing 2 changed files with 24 additions and 24 deletions. Show diff stats Hide diff stats

  1. +24 0 lib/sprockets.rb
  2. +0 24 lib/sprockets/engines.rb
24 lib/sprockets.rb
@@ -36,4 +36,28 @@ module Sprockets
36 36 module Cache
37 37 autoload :FileStore, "sprockets/cache/file_store"
38 38 end
  39 +
  40 + # Extend Sprockets module to provide global registry
  41 + extend Engines
  42 + @engines = {}
  43 +
  44 + # Cherry pick the default Tilt engines that make sense for
  45 + # Sprockets. We don't need ones that only generate html like HAML.
  46 +
  47 + # Mmm, CoffeeScript
  48 + register_engine '.coffee', Tilt::CoffeeScriptTemplate
  49 +
  50 + # JST engines
  51 + register_engine '.jst', JstProcessor
  52 + register_engine '.eco', EcoTemplate
  53 + register_engine '.ejs', EjsTemplate
  54 +
  55 + # CSS engines
  56 + register_engine '.less', Tilt::LessTemplate
  57 + register_engine '.sass', Tilt::SassTemplate
  58 + register_engine '.scss', Tilt::ScssTemplate
  59 +
  60 + # Other
  61 + register_engine '.erb', Tilt::ERBTemplate
  62 + register_engine '.str', Tilt::StringTemplate
39 63 end
24 lib/sprockets/engines.rb
@@ -71,28 +71,4 @@ def deep_copy_hash(hash)
71 71 hash.inject(initial) { |h, (k, a)| h[k] = a.dup; h }
72 72 end
73 73 end
74   -
75   - # Extend Sprockets module to provide global registry
76   - extend Engines
77   - @engines = {}
78   -
79   - # Cherry pick the default Tilt engines that make sense for
80   - # Sprockets. We don't need ones that only generate html like HAML.
81   -
82   - # Mmm, CoffeeScript
83   - register_engine '.coffee', Tilt::CoffeeScriptTemplate
84   -
85   - # JST engines
86   - register_engine '.jst', JstProcessor
87   - register_engine '.eco', EcoTemplate
88   - register_engine '.ejs', EjsTemplate
89   -
90   - # CSS engines
91   - register_engine '.less', Tilt::LessTemplate
92   - register_engine '.sass', Tilt::SassTemplate
93   - register_engine '.scss', Tilt::ScssTemplate
94   -
95   - # Other
96   - register_engine '.erb', Tilt::ERBTemplate
97   - register_engine '.str', Tilt::StringTemplate
98 74 end

0 comments on commit 67df578

Please sign in to comment.
Something went wrong with that request. Please try again.