gulp-terser
gulp plugin, compressed es6+ code.
Last updated a year 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 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

  • 1.2.0                                ...           latest (a year ago)

11 Versions

  • 1.2.0                                ...           a year ago
  • 1.1.7                                ...           2 years ago
  • 1.1.6                                ...           2 years ago
  • 1.1.5                                ...           2 years ago
  • 1.1.4                                ...           2 years ago
  • 1.1.3                                ...           2 years ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0 [deprecated]           ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 9
This Week 92
This Month 199
Last Day 10
Last Week 160
Last Month 606
Dependencies (4)
Dev Dependencies (16)

Copyright 2014 - 2016 © taobao.org |