[英]Include all javascript files in a directory to a html file in angularjs? with grunt?
[英]Compiling all shtml files into one html file using SSI or grunt
我正在嘗試為現有項目構建實時樣式指南。 作為其中的一部分,我想將一個文件夾中的所有shtml小部件都包含在一個html文件中。
我正在尋找的解決方案類型將遵循以下行為:
該項目通過快遞服務器同時運行grunt和SSI,因此我猜有兩個選擇。
我發現這個程序包確實包含很多東西,但是其中很多超出了我的知識水平,因此我什么都沒做。
這是到目前為止我的grunt文件的代碼:
includes: {
files: {
src: ['widgets/.shtml'], // Source files
dest: 'kitchen-sink', // Destination directory
flatten: true,
cwd: '.',
options: {
silent: true,
banner: '<!-- I am a banner <% includes.files.dest %> -->'
}
}
}
我可以看到它如何與單個命名文件一起工作,但是遍歷文件夾似乎是一項艱巨的任務。
我們歡迎任何可能的解決方案的建議。
最后,我使用了Qualcuno的建議來使用grunt-html-build。 效果很好,我可能會編寫另一個艱巨的任務,以編寫頁面上小部件的標題。
這是我的最終代碼:
htmlbuild: {
dist: {
src: 'kitchen_sink/kitchen-sink.shtml',
dest: 'prod/kitchen_sink/kitchen-sink.shtml',
options: {
sections: {
views: 'prod/templates/widgets/**/*.shtml',
templates: 'prod/templates/widgets/**/*.shtml'
}
}
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.