October 2017
Intermediate to advanced
458 pages
11h 13m
English
As you are deleting and minifying files, you may be interested in seeing exactly how many bytes you are saving. There is a plugin for that, called gulp-size:
npm install gulp-size --save-dev
Usage is simple:
var gulp = require('gulp');var minify = require('gulp-minify');var size = require('gulp-size');gulp.task('minify', ['clean'], function () { gulp.src('scripts/*.js') .pipe(size()) .pipe(minify(require('./minify.conf.js'))) .pipe(size()) .pipe(gulp.dest('prod'));});
This outputs the size of all the files before and after minification to the command window. You can also pass in some additional options to size:
.pipe(size({ title: 'Before minification', showFiles: true, showTotal: true, pretty: false}))
The title can be ...
Read now
Unlock full access