How to use the gulp-insert.append 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 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/'));
  }

gulp-insert

Append or Prepend a string with gulp

MIT
Latest version published 9 years ago

Package Health Score

54 / 100
Full package analysis