How to use gulp-insert - 10 common examples

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 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 pixelandtonic / garnishjs / gulpfile.js View on Github external
" * @version   " + version + "\n" +
        " * @license   MIT\n" +
        " */\n";

    var jqueryOpen = "(function($){\n" +
        "\n";

    var jqueryClose = "\n" +
        "})(jQuery);\n";

    return gulp.src(buildGlob, { base: dest })
        .pipe(plumber({ errorHandler: plumberErrorHandler }))
        .pipe(sourcemaps.init())
        .pipe(concat('garnish.js'))
        .pipe(insert.prepend(jqueryOpen))
        .pipe(insert.append(jqueryClose))
        .pipe(insert.prepend(docBlock))
        .pipe(gulp.dest(dest))
        .pipe(uglify())
        .pipe(concat('garnish.min.js'))
        .pipe(insert.prepend(docBlock))
        .pipe(sourcemaps.write('.', {
            mapFile: function(mapFilePath) {
                // source map files are named *.map instead of *.js.map
                return mapFilePath.replace('.js.map', '.map');
            }
        }))
        .pipe(gulp.dest(dest));
}
github angular / material / gulp / util.js View on Github external
});

  gutil.log("building js files...");

  const jsBuildStream = gulp.src(jsFiles)
  .pipe(filterNonCodeFiles())
  .pipe(utils.buildNgMaterialDefinition())
  .pipe(plumber())
  .pipe(ngAnnotate())
  .pipe(utils.addJsWrapper(true));

  const jsProcess = series(jsBuildStream, themeBuildStream())
  .pipe(concat('angular-material.js'))
  .pipe(BUILD_MODE.transform())
  .pipe(insert.prepend(config.banner))
  .pipe(insert.append(';window.ngMaterial={version:{full: "' + VERSION + '"}};'))
  .pipe(gulp.dest(config.outputDir))
  .pipe(gulpif(!IS_DEV, uglify({output: {comments: 'some'}})))
  .pipe(rename({extname: '.min.js'}))
  .pipe(gulp.dest(config.outputDir));

  return series(jsProcess, deployMaterialMocks());

  // Deploy the `angular-material-mocks.js` file to the `dist` directory
  function deployMaterialMocks() {
    return gulp.src(config.mockFiles)
    .pipe(gulp.dest(config.outputDir));
  }
}
github topcoat / topcoat / tasks / build-css.js View on Github external
function buildSkinFiles(colorStop, globs, prependString, appendString, dest) {
  prependString = prependString || '';
  appendString = appendString || '';
  dest = dest || 'dist/components/';

  return gulp.src(globs)
    .pipe(plumb())
    .pipe(insert.prepend(`@import '../../dist/vars/spectrum-dimensions.css';\n@import '../colorStops/spectrum-${colorStop}.css';${prependString}`))
    .pipe(insert.append(appendString))
    .pipe(postcss(processors))
    .pipe(replace(/^&/gm, '.spectrum')) // Any stray & in colorstops should just apply to .spectrum
    .pipe(rename(function(path) {
      path.dirname += '/colorStops';
      path.basename = colorStop;
    }))
    .pipe(gulp.dest(dest));
}
github topcoat / topcoat / tasks / build-css.js View on Github external
function buildMultistops(colorStop) {
    return gulp.src('dist/spectrum-' + colorStop + '.css')
      .pipe(plumb())
      // Simply wrap the file in the colorstop
      // This is a workaround for the fact that postcss-import and postcss-nested can't play together
      .pipe(insert.prepend(`.spectrum--${colorStop} {\n`))
      .pipe(insert.append('}\n'))
      .pipe(postcss([require('postcss-nested')]))
      .pipe(gulp.dest('dist/'));
  }
github IBM-Watson / a11y.js / tasks / dist.js View on Github external
gulp.task('dist--each', function (done) {
    distPaths = distPaths || toDist;
    outPath = outPath || placeDist;

    gulp.src(distPaths)
      .pipe(sourcemap.init())
      .pipe(insert.prepend('!function(){null===window.a11y&&(window.a11y={})}()\n'))
      .pipe(rename({
        extname: '.min.js'
      }))
      .pipe(uglify())
      .pipe(sourcemap.write('./'))
      .pipe(gulp.dest(outPath));
  });
github NeverBounce / chartjs-plugin-empty-overlay / gulpfile.js View on Github external
var task = function() {
    return gulp.src(srcDir + 'plugin.js')
      .pipe(rename(package.name + '.js'))
      .pipe(insert.prepend(header))
      .pipe(streamify(replace('{{ version }}', package.version)))
      .pipe(gulp.dest(outDir))
      .pipe(rename(package.name + '.min.js'))
      .pipe(streamify(uglify({ preserveComments: 'license' })))
      .pipe(gulp.dest(outDir));
  };
github tweenjs / tween.js / gulpfile.js View on Github external
gulp.task('min', function() {
	return gulp.src([
		'src/Tween.js'
	])
	.pipe(uglify())
	.pipe(insert.prepend(header))
	.pipe(rename('tween.min.js'))
	.pipe(gulp.dest('build'));
});
github risq / cratedigger / bower_components / tween.js / gulpfile.js View on Github external
gulp.task('min', function() {
	return gulp.src([
		'src/Tween.js'
	])
	.pipe(uglify())
	.pipe(insert.prepend(header))
	.pipe(rename('tween.min.js'))
	.pipe(gulp.dest('build'));
});

gulp-insert

Append or Prepend a string with gulp

MIT
Latest version published 9 years ago

Package Health Score

54 / 100
Full package analysis