2.1.0 • Published 3 years ago
gulp-terser v2.1.0
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;
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