mochiscript 0.4.0.pre10 → 0.4.0.pre12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ require 'tilt'
2
+ require 'sprockets/engines'
3
+
4
+ module Mochiscript::Rails
5
+ class Engine < ::Rails::Engine
6
+ config.before_configuration {}
7
+ end
8
+
9
+ #
10
+ # Mochiscript template implementation. See:
11
+ # http://github.com/jeffsu/mochiscript
12
+ #
13
+ class MochiscriptTemplate < Tilt::Template
14
+ self.default_mime_type = 'application/javascript'
15
+
16
+ def prepare
17
+ @ctx = Mochiscript::Context.new
18
+ end
19
+
20
+ def evaluate(scope, locals, &block)
21
+ return @ctx.parse(data)
22
+ end
23
+ end
24
+ end
25
+
26
+ module Sprockets
27
+ register_engine '.ms', Mochiscript::Rails::MochiscriptTemplate
28
+ end