将目录中的所有.haml文件转换为另一个目录中的.html [英] Converting all .haml files in a dir to .html in another dir
问题描述
在我正在工作的一个简单网站中,我有一个目录haml
和一个目录pages
. haml文件夹包含我正在处理的.haml文件,而pages文件夹包含我转换后的.html文件.
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
每个文件.
但是,有没有一种方法可以将haml文件夹中的所有.haml文件转换为pages文件夹中的等效.html文件?
However, is there a way to convert all the .haml files in my haml folder to an equivalent .html file in the pages folder?
类似的东西:haml haml/*.haml html/*.html
谢谢!
推荐答案
有一个不错的 html2haml gem为此
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
这篇关于将目录中的所有.haml文件转换为另一个目录中的.html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!