Sha256: cd58b4a03c0968b67eb11c988a4c11019023496896f5eceb7de088e73c1c5fcd

Contents?: true

Size: 883 Bytes

Versions: 5

Compression:

Stored size: 883 Bytes

Contents

require "coffee-script"

module Skim
  Template = Temple::Templates::Tilt(Skim::Engine, :register_as => :skim)

  class Template
    self.default_mime_type = "application/javascript"

    def coffee_script_src

      engine = Engine.new(options.merge({
        :streaming => false, # Overwrite option: No streaming support in Tilt
        :file => eval_file,
        :indent => 2
      }))
      src = engine.call(data)
<<-SRC
#{self.class.skim_src unless engine.options[:use_asset]}
return (context = {}) ->
  Skim.withContext.call {}, context, ->
#{src}
SRC
    end

    def prepare
      @src = CoffeeScript.compile(coffee_script_src)
    end

    def evaluate(scope, locals, &block)
      precompiled_template
    end

    def self.skim_src
      @@skim_src ||=
        File.read(File.expand_path("../../../vendor/assets/javascripts/skim.js.coffee", __FILE__))
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
skim-0.10.0 lib/skim/template.rb
skim-0.9.3 lib/skim/template.rb
skim-0.9.2 lib/skim/template.rb
skim-0.9.1 lib/skim/template.rb
skim-0.9.0 lib/skim/template.rb