2016-02-13 481 views
2

我已經傳遞了一個通過Visual Studio構建的項目,它包含一個index.html.bundle文件。在Visual Studio中,這些文件通常是通過運行構建工具來構建的,並且這會通過合併.bundle文件中的所有模板文件自動創建index.html頁面。將多個html模板合併爲一個index.html文件

但是我在Mac上運行這個項目並且無法訪問這個工具。

我想將所有的html模板合併成一個單獨的index.html模板,並想知道是否有一個可以自動執行此操作的工具(即吞吐等)?

+0

您可以使用[吞掉,文件內容到鍵](https://www.npmjs.com/package/gulp-file-contents-to-keys) – vsync

回答

1

我敢肯定,咕嘟咕嘟有一個工具,將做到這一點,但如果你只是想合併文件,然後cat將正常工作:

cat index1.html index2.html index3.html > index.html 
+0

這解決了我的問題,謝謝現在我只需要找到一種方法來實現這一點。 – Simon

2

我發現叫gulp-concat一飲而盡工具,可以讓我自動化這個過程。安裝完成後,我把它放到我的gulpfile.js中作爲一個新的任務。

gulp.task('html', function() { 
return gulp.src([ 
    'index1.html', 
    'index2.html', 
    'index3.html' 
]) 
.pipe(concat('index.html')) 
.pipe(gulp.dest('./')); 
});