Class: Slim::Template

Inherits:
Object
  • Object
show all
Includes:
SafeTemplate
Defined in:
lib/middleman-core/renderers/slim.rb

Instance Method Summary collapse

Methods included from SafeTemplate

#render

Constructor Details

#initialize(file, line, opts, &block) ⇒ Template

Returns a new instance of Template.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/middleman-core/renderers/slim.rb', line 13

def initialize(file, line, opts, &block)
  if opts.key?(:context)
    context_hack = {
      context: opts[:context]
    }

    ::Slim::Embedded::SassEngine.disable_option_validator!
    %w(sass scss markdown).each do |engine|
      ::Slim::Embedded.options[engine.to_sym] = context_hack
    end
  end

  super
end

Instance Method Details

#precompiled_preamble(locals) ⇒ Object



28
29
30
# File 'lib/middleman-core/renderers/slim.rb', line 28

def precompiled_preamble(locals)
  "__in_slim_template = true\n" << super
end