gulp使用gulp-file-include將header/footer引入頁面

少有人走的路發表於2019-03-18

前言:gulp將header/footer引入頁面 這是使用fs、gulp-replace的一個方法,比較麻煩,每新增一個模組,就要寫一個引入。也有其他更為簡單的方法,gulp-file-include更為的簡單簡略,使用很久了,感覺不錯,記錄之。 1、引入外掛

gulp使用gulp-file-include將header/footer引入頁面
2、寫task使用
gulp使用gulp-file-include將header/footer引入頁面
3、頁面引入,哪裡需要哪裡就include。
gulp使用gulp-file-include將header/footer引入頁面
gulp使用gulp-file-include將header/footer引入頁面
總結

1:不用寫fs,哪裡需要引入就直接include,簡單、簡略、好用。

2:生成後的dist檔案中,保留了原先引入的模板header、footer、nav、sidebar等等,方便查閱修改,更重要的是方便後臺程式猿拿來直接使用

相關文章