2.1.0 • Published 3 years ago

gulp-terser v2.1.0

Weekly downloads
50,272
License
MIT
Repository
github
Last release
3 years ago

gulp-terser

Gulp plugin, compressed es6+ code.

Install

$ npm install gulp-terser --save-dev

or

$ yarn add gulp-terser --dev

How to use

const gulp = require('gulp');
const terser = require('gulp-terser');

function es(){
  return gulp.src('./src/index.js')
    .pipe(terser())
    .pipe(gulp.dest('./build'));
}

exports.default = es;

Options

Terser configuration can be viewed https://github.com/terser-js/terser#minify-options.

const gulp = require('gulp');
const terser = require('gulp-terser');

function es(){
  return gulp.src('./src/index.js')
    .pipe(terser({
      keep_fnames: true,
      mangle: false
    }))
    .pipe(gulp.dest('./build'));
}

exports.default = es;

Use a 3rd-party version of minifier

const gulp = require('gulp');
const terser = require('terser');
const gulpTerser = require('gulp-terser');

function es(){
  return gulp.src('./src/index.js')
    .pipe(gulpTerser({}, terser.minify))
    .pipe(gulp.dest('./build'));
}

exports.default = es;

Use sourcemaps

You can use sourcemaps like this:

const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const terser = require('gulp-terser');

function es(){
  return gulp.src('./src/**/*.js')
    .pipe(sourcemaps.init())
    .pipe(terser())
    .pipe(sourcemaps.write('./'))
    .pipe(gulp.dest('./build'));
}

exports.default = es;
@tyz-wallet/tyz-wallet-core-build@webx/gulpadgile-dev@alotool/bloggerpackreadytest-testcafe@alotool/alotool-clizoos-mp-serviceheri-gulpwatcher@conorepo/gulp-terser@cloudhub-js/sails-graphqlfridays-for-future-bootstrap-4@infinitebrahmanuniverse/nolb-gulp-t@everything-registry/sub-chunk-1812chenyfan-test-hexoplusplushexoplusplus@tangible/builderbeer-library-packagecool-resource-optimizerconsentaclesct-mapapps-gulp-jseonacore-buildfamilyhubs-frontendeasy-view-loadereasy-view-loader-servereasy-auth-packezcoregulp-gridfwgulp-assets-composergulp-angular2-project-registrygulp-caddygenerator-gulp-sass-starterpackfrontiogmc-ezcore-depgurt-fragsgulp-sass-starterpackgulp-uikitgulpconnectedv2gulpfile-configgulpfile.jsgulp2gogoldnet-fe-toolsproa-gulppenthouse-idepcfepcfe-cli@ducatus/ducatuscore-build@edenjs/cli@edenjs/serviceworker@htmlacademy/in-browser-console.jsljc-pageslitchi-mp-serviceliferay-theme-tasksminecraft-addon-toolchain-terserscarletsframe-compilerserato-cssspec-upspec-up-tstan-builderstr8r-corestop14-themesystem-legacysnjswimcloud-applicationssyy-mp-servicetars-clitestcafe-technovertmy-slick-gallerymulticore-buildngs-template-pot2olo-gulp-helpersreadytest-tcreacty-frameworkquackagetoms-gulp-configtrack-and-field-webpacktypewriting-animationui5-lib-utilwebfactory-gulp-preset@plume/lib@polygenx/archive@touchtribe/frontend-scripts@tririga/tri-bundler@pipflow/core@thomasperi/my-gulp-tasks@scm-manager/ui-bundler@vapaaradikaali/react-server@viscosoft/remy-cli@isaacadams/webvendor@coldfrontlabs/gulp-templatesbaidabedrockapp@grrr/gulpfileadgile@papapaya/gulp-boilerplateacyort-donob-renderer@evokegroup/str8r-core-multilang@globalreach/gulp-tasksauth-guardian-apiautofrontbivcore-buildbitcore-build
2.1.0

3 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

5 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago