8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/haute/generator.rb', line 8
def generate(options, template=nil)
template = File.expand_path("../../../app/styleguide.html.haml", __FILE__) unless template.present?
template_string = File.read(template)
case File.extname(template)
when ".erb"
ERB.new(template_string).result(OpenStruct.new(options).instance_eval { binding })
when ".haml"
Haml::Engine.new(template_string).render(OpenStruct.new(options).instance_eval { binding })
else
raise "You must supply an ERB or HAML template path."
end
end
|