javascript
Minify js using Gulp
//Installation - npm install --save-dev gulp-uglify
var gulp = require('gulp');
var uglify = require('gulp-uglify');
gulp.task('minifyjs', function () {
return gulp.src('lib/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist'));
});
You can minify JS files in Gulp using gulp-uglify npm package. It will minify and replace your variables names and other declarations into their shortest form. This is also used to compress JS files at its best and it makes the JS file size small and it takes minimum time response for a request.
NPM package installation
npm install --save-dev gulp-uglify
Was this helpful?
Similar Posts