gulp-terser
gulp plugin, compressed es6+ code.
Last updated 9 months ago by duan602728596 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gulp-terser 
SYNC missed versions from official npm registry.

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;

Current Tags

  • 2.0.1                                ...           latest (9 months ago)

19 Versions

  • 2.0.1                                ...           9 months ago
  • 2.0.0                                ...           10 months ago
  • 1.4.1                                ...           a year ago
  • 1.4.0                                ...           a year ago
  • 1.3.2                                ...           a year ago
  • 1.3.1                                ...           a year ago
  • 1.3.0                                ...           a year ago
  • 1.2.1                                ...           a year ago
  • 1.2.0                                ...           2 years ago
  • 1.1.7                                ...           3 years ago
  • 1.1.6                                ...           3 years ago
  • 1.1.5                                ...           3 years ago
  • 1.1.4                                ...           3 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0 [deprecated]           ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 2
Last Day 0
Last Week 0
Last Month 7
Dependencies (4)
Dev Dependencies (18)
Dependents (112)

Copyright 2013 - present © cnpmjs.org | Home |