Add files by contents at any point in the pipeline.
Install:
npm install gulp-add --save-dev
Example:
var add = require('gulp-add');
gulp.task('some-task', function() {
return gulp.src(['some files'])
.pipe(add('filename1.txt', 'First file contents'))
.pipe(add({
'filename2.txt': 'Second file contents',
'filename3.txt': 'Third file contents'
}))
.pipe(gulp.dest('./build'));
});
By default, new files are being added to the end of the stream. You can insert new files in the beginning of the stream:
.pipe(add('filename1.txt', 'First file contents', true))
or
.pipe(add({
'filename2.txt': 'Second file contents',
'filename3.txt': 'Third file contents'
}, true))