Sha256: 251d70bf2247c3b63b2a325eaca65ec5a1ba432d2b050e6c9f7e0945af0618ac
Contents?: true
Size: 701 Bytes
Versions: 2
Compression:
Stored size: 701 Bytes
Contents
require 'sprockets' require 'sprockets/engines' require 'tilt' require 'action_view' require 'action_view/helpers' require 'action_view/helpers/javascript_helper' module Sprockets module JSRender class Processor < Tilt::Template include ActionView::Helpers::JavaScriptHelper def self.default_mime_type 'application/javascript' end def prepare end def evaluate(scope, locals, &block) <<-JSRENDER (function() { $.templates({#{scope.logical_path.gsub(/^jsrender\/(.*)$/i, "\\1").inspect}: "#{escape_javascript data}"}); }).call(this); JSRENDER end end end register_engine '.jsr', ::Sprockets::JSRender::Processor end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sprockets-jsrender-0.1.3 | lib/sprockets/jsrender/jsrender_processor.rb |
sprockets-jsrender-0.1.2 | lib/sprockets/jsrender/jsrender_processor.rb |