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

Commit

Permalink
Merge branch 'master' into 2.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
josh committed Oct 11, 2011
2 parents 17ab387 + 9f3474d commit 794c26d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/sprockets/jst_processor.rb
Expand Up @@ -6,14 +6,21 @@ def self.default_mime_type
'application/javascript' 'application/javascript'
end end


def self.default_namespace
'this.JST'
end

def prepare def prepare
@namespace = self.class.default_namespace
end end


attr_reader :namespace

def evaluate(scope, locals, &block) def evaluate(scope, locals, &block)
<<-JST <<-JST
(function() { (function() {
this.JST || (this.JST = {}); #{namespace} || (#{namespace} = {});
this.JST[#{scope.logical_path.inspect}] = #{indent(data)}; #{namespace}[#{scope.logical_path.inspect}] = #{indent(data)};
}).call(this); }).call(this);
JST JST
end end
Expand Down

0 comments on commit 794c26d

Please sign in to comment.