Sha256: a0bb5b8105c64c991f4efe7d62738df18fc4320d29f645942a6812fdcff246b6
Contents?: true
Size: 1000 Bytes
Versions: 3
Compression:
Stored size: 1000 Bytes
Contents
require 'tilt' module Sprockets # Tilt engine class for the Eco compiler. Depends on the `eco` gem. # # For more infomation see: # # https://github.com/sstephenson/ruby-eco # https://github.com/sstephenson/eco # class EcoTemplate < Tilt::Template # Eco templates always produced compiled JS. We can set Tilt's # default mime type hint. def self.default_mime_type 'application/javascript' end # Autoload eco library. If the library isn't loaded, Tilt will produce # a thread safetly warning. If you intend to use `.eco` files, you # should explicitly require it. def initialize_engine require_template_library 'eco' end def prepare end # Compile template data with Eco compiler. # # Returns a JS function definition String. The result should be # assigned to a JS variable. # # # => "function(...) {...}" # def evaluate(scope, locals, &block) Eco.compile(data) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bpm-0.1.4 | vendor/sprockets/lib/sprockets/eco_template.rb |
bpm-0.1.3 | vendor/sprockets/lib/sprockets/eco_template.rb |
bpm-0.1.2 | vendor/sprockets/lib/sprockets/eco_template.rb |