You can use https://www.npmjs.org/package/gulp-html-to-json .
It has a different function and is very easy to use. It will generate exactly what you need.
var templates = { template_file_name : '...template HTML string...', template_file_name2 : '...template HTML string...', template_file_name3 : '...template HTML string...' }
It also has an angular templateCache generator if you use angularjs .
John turingan
source share