How to use HAML to generate standalone HTML files via a layout template

与世无争的帅哥 提交于 2019-12-11 15:07:34

问题


I use haml a lot when developing web applications but for the job I am doing right now all the client needs is flat HTML files and some javascript. There are quite a few files I thought it might be easier to code them all up using haml, with a layout file to capture the stuff common to each page.

I checked the haml docs and they offer a simple example:

haml hello_world.haml hello_world.html

that happily generates a hello world page from my template. I've scoured the docs for information on how I could get it to recognise a layout.haml file however but have not had any luck.

The goal is to set up a directory structure like

/
 - templates/
    - layout.haml
    - other.haml
    - pages.haml
 - output/

and from command line just go

haml templates output

and generate other.html and pages.html

Is this possible, or am I looking at the wrong tool for this job?


回答1:


I'd look at using Jekyll with a HAML workflow something like this http://mikeferrier.com/2011/04/29/blogging-with-jekyll-haml-sass-and-jammit/




回答2:


nanoc is pretty good too.. possibly simpler than jekyll in some ways, though with less goodies



来源:https://stackoverflow.com/questions/12242144/how-to-use-haml-to-generate-standalone-html-files-via-a-layout-template

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!