Sha256: ba91d61164bce0d72211f27563e13b36b48b3f3b8299b41784c7a7bef5d6be9a

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

require "tilt"
require "sass"
require "compass/core"
require "handlebars.rb"
require "coffee_script"

module Tilt
  class JavascriptTemplate < PlainTemplate
    self.default_mime_type = 'application/javascript'
  end

  class CSSTemplate < PlainTemplate
    self.default_mime_type = 'text/css'
  end

  class CompassSassTemplate < SassTemplate
    self.default_mime_type = 'text/css'

  private
    def sass_options
      super.merge(
        style: :expanded,
        line_numbers: true,
        load_paths: Linner.env.paths << Compass::Core.base_directory("stylesheets")
      )
    end
  end

  class CompassScssTemplate < CompassSassTemplate
    self.default_mime_type = 'text/css'

  private
    def sass_options
      super.merge(:syntax => :scss)
    end
  end

  class HandlebarsTemplate < Template
    self.default_mime_type = 'text/template'

    def prepare; end

    def evaluate(scope, locals, &block)
      @output ||= Handlebars.precompile(data)
    end
  end

  register CSSTemplate, "css"
  register JavascriptTemplate, "js"
  register HandlebarsTemplate, "hbs", "handlebars"

  register CompassSassTemplate, "sass"
  prefer CompassSassTemplate

  register CompassScssTemplate, "scss"
  prefer CompassScssTemplate
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
linner-0.9.0 lib/linner/template.rb
linner-0.8.7 lib/linner/template.rb
linner-0.8.6 lib/linner/template.rb
linner-0.8.5 lib/linner/template.rb
linner-0.8.4 lib/linner/template.rb
linner-0.8.3 lib/linner/template.rb
linner-0.8.2 lib/linner/template.rb
linner-0.8.1 lib/linner/template.rb
linner-0.8.0 lib/linner/template.rb