How to use gulp-terser - 6 common examples

To help you get started, we’ve selected a few gulp-terser 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 felixhayashi / TW5-TiddlyMap / gulpfile.babel.js View on Github external
const uglifyOpts = {
    compress: false, // no further optimization
    output: {
      comments: 'some',
    }
  };

  const sourceMapOpts = {
    destPath: outPath.maps,
    sourceMappingURLPrefix: '.'
  };

  return gulp.src(pluginSrc + '/**/*.js')
    .pipe(sourcemaps.init())
    .pipe(babel())
    .pipe(gulpif (argv.production, terser(uglifyOpts)))
    .pipe(sourcemaps.write('./maps', sourceMapOpts))
    .pipe(gulp.dest(outPath.dist));

});
github HandshakeAlliance / testnet-faucet / gulpfile.babel.js View on Github external
function prodScripts() {
  return gulp
    .src(paths.scripts.src)
    .pipe(replace("http://localhost:7000", "https://hnscan.com"))
    .pipe(sourcemaps.init())
    .pipe(terser())
    .pipe(concat("main.min.js"))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(paths.scripts.dest));
}
github HandshakeAlliance / testnet-faucet / gulpfile.babel.js View on Github external
function scripts() {
  return gulp
    .src(paths.scripts.src)
    .pipe(sourcemaps.init())
    .pipe(terser())
    .pipe(concat("main.min.js"))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(paths.scripts.dest));
}
github HandshakeAlliance / handshakealliance.org / gulpfile.babel.js View on Github external
function scripts() {
  return gulp
    .src(paths.scripts.src)
    .pipe(sourcemaps.init())
    .pipe(terser())
    .pipe(concat("main.min.js"))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(paths.scripts.dest));
}
github HandshakeAlliance / HNScan / gulpfile.babel.js View on Github external
function scripts() {
  return gulp
    .src(paths.scripts.src)
    .pipe(sourcemaps.init())
    .pipe(terser())
    .pipe(concat("main.min.js"))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest(paths.scripts.dest));
}
github grrr-amsterdam / gulpfile / tasks / javascript-vendor.js View on Github external
/**
     * Somehow gulpif and concat don't play nice at all, so we use this
     * ugly if/else-statement for now ¯\_(ツ)_/¯
     */
    if (entry.bundle) {
      return src(entry.src)
        .pipe(concat(entry.bundle))
        .pipe(terser({
          compress: {
            drop_console: true,
          },
        }))
        .pipe(dest(entry.dist));
    }
    return src(entry.src)
      .pipe(terser({
        compress: {
          drop_console: true,
        },
      }))
      .pipe(dest(entry.dist));
  }));
};

gulp-terser

gulp plugin, compressed es6+ code.

MIT
Latest version published 3 years ago

Package Health Score

53 / 100
Full package analysis

Popular gulp-terser functions