Minify One File

I just need to minify one file. Does that really mean I have to write a gulp task?

The answer is emphatically “Yes!”

You will minimize another file at some time in the future.

Here is a very basic script where name is included. I am just going to leave this here in case I want to add arguments and make it more generally useful at some point : )

gulpfile.js
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');

gulp.task('compress', function () {
return gulp.src('jquery-3.2.0.js')
.pipe(uglify())
.pipe(rename('jquery-3.2.0.min.js'))
.pipe(gulp.dest('.'));
});

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *


nine + = 12

This site uses Akismet to reduce spam. Learn how your comment data is processed.