Class: HoganCompiler

Inherits:
Stitch::Compiler
  • Object
show all
Defined in:
lib/gumdrop/stitch_support.rb

Overview

Not so sure on this oneā€¦

Instance Method Summary collapse

Instance Method Details

#compile(path) ⇒ Object

A compile method which takes a file path, and returns a compiled string



38
39
40
41
42
43
44
# File 'lib/gumdrop/stitch_support.rb', line 38

def compile(path)
  content = File.read(path)
  %{
    var template = Hogan.compile(#{content.to_json});
    module.exports = (function(data){ return template.render(data); });
  }
end