class Jade::Template

Public Class Methods

engine_initialized?() click to toggle source
# File lib/jade/template.rb, line 6
def self.engine_initialized?
  defined? ::Jade
end

Public Instance Methods

evaluate(context, locals, &block) click to toggle source

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, which is a function that takes a single argument containing the locals to use in rendering the template:

# => function template(locals) { ... }
# File lib/jade/template.rb, line 30
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
initialize_engine() click to toggle source
# File lib/jade/template.rb, line 10
def initialize_engine
  require_template_library 'jade'
end
prepare() click to toggle source
# File lib/jade/template.rb, line 14
def prepare
end