如何使用HAML通过布局模板生成独立的HTML文件 [英] How to use HAML to generate standalone HTML files via a layout template

查看:139
本文介绍了如何使用HAML通过布局模板生成独立的HTML文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发Web应用程序时,我经常使用haml,但是对于我现在正在做的工作,所有客户端需求都是平面HTML文件和一些javascript.我认为有很多文件可能会更容易使用haml进行编码,而布局文件可以捕获每一页的常用内容.

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.

我检查了haml文档,他们提供了一个简单的示例:

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

haml hello_world.haml hello_world.html

很高兴从我的模板中生成一个Hello World页面.我已经在文档中搜寻了有关如何获取它以识别layout.haml文件的信息,但是没有任何运气.

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/

从命令行开始

haml templates output

并生成other.htmlpages.html

这是可能的,还是我在寻找错误的工具来完成这项工作?

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

推荐答案

我将使用 Jekyll 使用HAML工作流程,例如 http: //mikeferrier.com/2011/04/29/blogging-with-jekyll-haml-sass-and-jammit/

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/

这篇关于如何使用HAML通过布局模板生成独立的HTML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆