Module: HamlSupport
- Defined in:
- lib/calatrava/tasks/haml.rb
Defined Under Namespace
Classes: Helper
Class Method Summary collapse
- .compile(haml_path, html_dir, options = {}) ⇒ Object
- .compile_hybrid_page(page_path, output_path, options = {}) ⇒ Object
- .render_haml(options) ⇒ Object
Class Method Details
.compile(haml_path, html_dir, options = {}) ⇒ Object
50 51 52 53 54 55 56 57 58 |
# File 'lib/calatrava/tasks/haml.rb', line 50 def compile(haml_path, html_dir, = {}) puts "haml: #{haml_path} -> #{html_dir}" [:helper] ||= Helper.new [:template] = haml_path [:out] = File.join(html_dir, File.basename(haml_path, '.*') + '.html') render_haml() end |
.compile_hybrid_page(page_path, output_path, options = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/calatrava/tasks/haml.rb', line 40 def compile_hybrid_page(page_path, output_path, = {}) puts "haml page: #{page_path} -> #{output_path}" [:helper] = Helper.new(page_path) [:template] = "shell/layouts/single_page.haml" [:out] = File.join(output_path, File.basename(page_path, '.*') + '.html') render_haml() end |
.render_haml(options) ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/calatrava/tasks/haml.rb', line 60 def render_haml() html_path = [:out] template = IO.read([:template]) html = Haml::Engine.new(template).render([:helper]) IO.write(html_path, html) end |