Sha256: ac366a665405915973a1c644e0ae56d7c54e28f39fa43f97af6376dd6da43d14

Contents?: true

Size: 686 Bytes

Versions: 6

Compression:

Stored size: 686 Bytes

Contents

require 'eco'

module Sprockets
  # Template 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
  #
  module EcoTemplate
    VERSION = '1'

    # Compile template data with Eco compiler.
    #
    # Returns a JS function definition String. The result should be
    # assigned to a JS variable.
    #
    #     # => "function(...) {...}"
    #
    def self.call(input)
      data = input[:data]
      key  = ['EcoTemplate', ::Eco::Source::VERSION, VERSION, data]
      input[:cache].fetch(key) do
        ::Eco.compile(data)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sprockets-3.0.0.beta.6 lib/sprockets/eco_template.rb
sprockets-3.0.0.beta.5 lib/sprockets/eco_template.rb
sprockets-3.0.0.beta.4 lib/sprockets/eco_template.rb
sprockets-3.0.0.beta.3 lib/sprockets/eco_template.rb
sprockets-3.0.0.beta.2 lib/sprockets/eco_template.rb
sprockets-3.0.0.beta.1 lib/sprockets/eco_template.rb