我正在使用handlebars.js为我们的单页应用程序呈现客户端模板(在node.js服务器端使用Jade)。如何在bash命令行上输出文件列表
我想在服务器端预编译句柄模板并将它们捆绑为一个JS文件发送给客户端。
目前,我用handlebars
编译模板,像这样:
$ handlebars template1.handlebars template2.handlebars -f precompiled_templates.js
我想编写一个bash脚本,可以读取所有的目录中*.handlebars
文件,然后通过把手编译运行它们。所以,如果我有一个目录,如下所示:在模板目录
templates/
temp1.handlebars
temp2.handlebars
temp3.handlebars
temp4.handlebars
运行我的bash脚本(或者一个行命令)将基本上运行以下handlebars
命令:
$ handlebars temp1.handlebars temp2.handlebars temp3.handlebars temp4.handlebars -f precompiled_templates.js
有谁知道我如何编写一个bash脚本来获取目录中的所有句柄文件到上面的命令行中?
我试过'$ handlebars * .handlebars -f ...'但它没有工作,但那是因为我指向错误的目录!问题解决了! – Gaurav