4.0.1 • Published 12 months ago

gulp-plugin-terser v4.0.1

Weekly downloads
5
License
MIT
Repository
github
Last release
12 months ago

gulp-plugin-terser Tests Version

Gulp plugin to minify files with terser

Getting Started

Installation

Installation can be done via package managers such as npm or yarn

$ npm install -D gulp-plugin-terser
# or
$ yarn add --dev gulp-plugin-terser

Usage

// gulpfile.js

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

function minify() {
  const options = {
    suffix: '.min.js',
    terserOptions: {
      output: {
        comments: true,
      },
    },
  };

  return gulp
    .src('dist/*.js', { sourcemaps: true })
    .pipe(sourcemap.init())
    .pipe(terser(options))
    .pipe(sourcemap.write('.'))
    .pipe(gulp.dest('dist/', { sourcemaps: '.' }));
}

gulp.series(minify);

The above gulp task will minify all the .js files in the dist directory and writes it into a new file with extension .min.js in the same directory.

Options

4.0.1

12 months ago

4.0.0

12 months ago

3.0.0

12 months ago

2.1.0

3 years ago

2.0.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

6 years ago

1.0.0

6 years ago