Sha256: fed98b5b1ab10649b650e129e23ca2fa7aa6f63c01e0f2834b2a954a3248228c
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
require 'tilt' module Jade class Template < Tilt::Template def self.engine_initialized? defined? ::Jade end def initialize_engine require_template_library 'jade' end def prepare end # Compile template data using Jade compiler. # # This returns a String containing a JS function, which is intended # to be used with the Sprockets JST engine. Name your file so that # it is processed by both of these engines, and then the template # will be available on the JST global on the front end. # # For example, `my_template.jst.jade` will be available on the front # end as JST['my_template'], which is a function that takes a single # argument containing the locals to use in rendering the template: # # # => function template(locals) { ... } # def evaluate(context, locals, &block) options = { } options[:filename] = file jade_config = context.environment.context_class.jade_config.merge(options) Jade.compile(data, jade_config) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
jade-rails-adapter-1.11.0 | lib/jade/template.rb |