How to use the gulp-insert.transform function in gulp-insert

To help you get started, we’ve selected a few gulp-insert examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / gulp-insert / gulp-insert-tests.ts View on Github external
gulp.task('gulp-insert-tests', () => {
    return gulp.src('*.js')
        .pipe(insert.prepend('/* Inserted using gulp-insert prepend method */\n'))
        .pipe(insert.prepend('\n/* Inserted using gulp-insert append method */'))
        .pipe(insert.wrap(
            '/* Inserted using gulp-insert wrap method */\n',
            '\n/* Inserted using gulp-insert wrap method */'
        ))
        .pipe(insert.transform((contents, file) => {
            var comment = '/* Local file: ' + file.path + ' */\n';
            return comment + contents;
        }))
        .pipe(gulp.dest('gulp-insert'));
});
github travist / jsencrypt / gulpfile.js View on Github external
gulp.task('license', function() {
  return gulp.src(licenses)
    .pipe(insert.transform(function(contents, file) {
      return 'File: ' + file.path.replace(__dirname, '') + "\n" + contents;
    }))
    .pipe(concat('LICENSE.txt'))
    .pipe(gulp.dest(''));
});
github fractor / nntailoring / tfmeter / node_modules / typescript / Gulpfile.ts View on Github external
function baselineDelete(subfolder = "") {
    return gulp.src(["tests/baselines/local/**/*.delete"])
        .pipe(insert.transform((content, fileObj) => {
            const target = path.join(refBaseline, fileObj.relative.substr(0, fileObj.relative.length - ".delete".length));
            del.sync(target);
            del.sync(fileObj.path);
            return "";
        }));
}
github mojs / mojs / gulpfile.js View on Github external
gulp.task('update-main-file-version', function(e){
  return gulp.src('js/mojs.babel.js')
  .pipe(plumber())
  .pipe(insert.transform(function(contents) {
    var newString =  'revision:   \''+currentVersion+'\'';
    return contents
    .replace(/revision\:\s+?(\'|\")\d+\.\d+\.+\d+(\'|\")/i, newString);
  }))
  .pipe(gulp.dest('js/'))
});
github mojs / mojs-player / gulpfile.js View on Github external
gulp.task('attribute-lib', function() {
  return gulp.src(libMainFile)
  .pipe(plumber())
  .pipe(insert.transform(function(contents) {
    return credits + contents;
  }))
  .pipe(gulp.dest('./lib'))
});

gulp-insert

Append or Prepend a string with gulp

MIT
Latest version published 9 years ago

Package Health Score

54 / 100
Full package analysis