Sha256: cd7b28062948b5764f4a2dee36e77b74d962b48c73aeff385e760aa4b80c5cb7
Contents?: true
Size: 726 Bytes
Versions: 1
Compression:
Stored size: 726 Bytes
Contents
require 'sprockets/engines' require 'tilt' require 'action_view' require 'action_view/helpers' require 'action_view/helpers/javascript_helper' module Sprockets module Jquery module Tmpl class TmplProcessor < Tilt::Template include ActionView::Helpers::JavaScriptHelper def self.default_mime_type 'application/javascript' end def prepare end def evaluate(scope, locals, &block) <<-TMPL (function($) { $.template(#{scope.logical_path.gsub(/^tmpls\/(.*)$/i, "\\1").inspect}, "#{escape_javascript data}"); })(jQuery); TMPL end end end end register_engine '.tmpl', ::Sprockets::Jquery::Tmpl::TmplProcessor end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sprockets-jquery-tmpl-0.1.0 | lib/sprockets/jquery/tmpl/tmpl_processor.rb |