Sha256: 5c29860338acdbc5f5366ab2eb6feb1f94ae5dc1665e438388eae048c024046a

Contents?: true

Size: 523 Bytes

Versions: 3

Compression:

Stored size: 523 Bytes

Contents

require 'tilt'

module MarionetteDust
  class TiltDust < Tilt::Template
    def self.default_mime_type
      'application/javascript'
    end

    def evaluate(scope, locals, &block)
      template_name = scope.logical_path.to_s.gsub('"', "")
      compiled = Dust.precompile(data, template_name)
      <<-TEMPLATE
        (function(ctx, callback) {
          dust.loadSource(#{compiled.inspect});
          dust.render('#{template_name}', ctx, callback);
        })
      TEMPLATE
    end

    def prepare; end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
marionette_dust-0.1.0 lib/dust_engine/tilt_dust.rb
marionette_dust-0.0.3 lib/dust_engine/tilt_dust.rb
marionette_dust-0.0.2 lib/dust_engine/tilt_dust.rb