Converting all .haml files in a dir to .html in an

2019-07-04 17:11发布

In a simple website I'm working on, I have a directory haml and a directory pages. The haml folder contains the .haml files I work on, and the pages folder contains my converted .html files.

I know I can convert the files, from the website root directory, by doing:

haml haml/about.haml pages/about.html for each file.

However, is there a way to convert all the .haml files in my haml folder to an equivalent .html file in the pages folder?

Something like: haml haml/*.haml html/*.html

Thanks!

标签: haml
3条回答
乱世女痞
2楼-- · 2019-07-04 17:18

There's a python script that sounds like it will do exactly what you want...

I haven't tested it, but per the README, it sounds like it's as simple as:

python haml2html.py [input_dir] [output_dir]

查看更多
爷、活的狠高调
3楼-- · 2019-07-04 17:21

guard watches haml files, compiles them, you can set an output dir as well.

https://github.com/guard/guard-haml sounds like an option.

查看更多
趁早两清
4楼-- · 2019-07-04 17:22

There is a nice html2haml gem for this purpose

and you can run it on a directory using

find . -name \*.erb -print | sed 'p;s/.erb$/.haml/' | xargs -n2 html2haml
查看更多
登录 后发表回答