Class: Themify::TemplateEngine

Inherits:
Tilt::Template
  • Object
show all
Defined in:
lib/themify/template_engine.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_mime_typeObject



7
# File 'lib/themify/template_engine.rb', line 7

def self.default_mime_type; 'text/css'; end

Instance Method Details

#evaluate(scope, locals, &block) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/themify/template_engine.rb', line 13

def evaluate(scope, locals, &block)
  css_files = []
  @templates.each.with_index do |template, template_index|
    tree = ::Sass::Engine.new(data, sass_options).to_tree
    process_node tree, template, template_index + 1
    css_files << tree.to_sass
  end
  out = ''
  css_files.each.with_index { |css, i| out << "/* Template #{i+1} */\n\n#{css} \n" }
  out
end

#prepareObject



9
10
11
# File 'lib/themify/template_engine.rb', line 9

def prepare
  @templates = Themify.templates
end