Browse files

Merge branch 'master' into 2.1.x

  • Loading branch information...
2 parents 17ab387 + 9f3474d commit 794c26d7bc1aef88866766651b56f488276e9d1e @josh josh committed Oct 11, 2011
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/sprockets/jst_processor.rb
View
11 lib/sprockets/jst_processor.rb
@@ -6,14 +6,21 @@ def self.default_mime_type
'application/javascript'
end
+ def self.default_namespace
+ 'this.JST'
+ end
+
def prepare
+ @namespace = self.class.default_namespace
end
+ attr_reader :namespace
+
def evaluate(scope, locals, &block)
<<-JST
(function() {
- this.JST || (this.JST = {});
- this.JST[#{scope.logical_path.inspect}] = #{indent(data)};
+ #{namespace} || (#{namespace} = {});
+ #{namespace}[#{scope.logical_path.inspect}] = #{indent(data)};
}).call(this);
JST
end

0 comments on commit 794c26d

Please sign in to comment.