gulp-transform-head
.pipe(transformHead(delim, transformer, useBuffers))
The thing to wait until true, if number: the amount of lines
The function to transform the head of the file
Force buffers in the delim and transformer functions
var transformHead = require('gulp-transform-head');
gulp.src('./foo/*.js')
.pipe(transformHead(0, function(data) { return '"use scrict";\n' + data }))
.pipe(gulp.dest('./dist/')
gulp.src('./bar/*.js')
.pipe(transformHead(1, function(data) {
if (/(['"])use scrict\1/.test(data.split('\n')[0])) {
throw new gutil.PluginError('plugin', 'You need to use scrict mode');
}
return '"use scrict";\n' + data;
}))
.pipe(gulp.dest('./dist/')
gulp.src('./baz/*.js')
.pipe(transformHead('(function(window', function(data) {
return '(function main(window' + data;
}))
.pipe(gulp.dest('./dist/')