gulp-include
gulp-include copied to clipboard
Implement Type Handlers
Example file:
//= require handler=json src/json/myJSON.json
Example build process:
gulp.src([
'src/js/file.src.js',
])
.pipe(include({
typeHandlers: {
json: function (fileContent) {
return 'list.push(JSON.parse("'+escapeJSON(fileContent)+'"));';
}
}
}))
.pipe(rename('file.js'))
.pipe(gulp.dest('assets/js/'));
My current method for inserting JSON:
list.push(
//= require src/json/myJSON.json
);
//Pray that it works
Ditto, this would be a great addition to this package. I would use this feature immediately.