gulp-concat-to-json
v1.0.3
Published
concat files and convert the content to JSON
Downloads
2
Readme
gulp-concat-to-json
concat files and convert the content to JSON
example, concat all html templates to a js file:
var concatToJson = require('gulp-concat-to-json')
gulp.src('./tpl/**/*.html')
.pipe(minifyHTML({conditionals: true, spare: true}))
.pipe(concatToJson(path.join(__dirname), path.join(__dirname, 'tpl/all_templates.js')))
.pipe(replace(/^/, 'module.exports = '))
.pipe(gulp.dest('./tpl/'))
files:
tpl/a.html:
<h1>Hi</h1>
tpl/b.html
<div>Hi</div>
convert to:
tpl/all_templates.js
{
"tpl/a.html": "<h1>Hi</h1>",
"tpl/b.html": "<div>Hi</div>"
}