Display the size of your project
Logs out the total size of files in the stream and optionally the individual file-sizes.
$ npm install --save-dev gulp-size
var gulp = require('gulp');
var size = require('gulp-size');
gulp.task('default', function () {
return gulp.src('fixture.js')
.pipe(size())
.pipe(gulp.dest('dist'));
});
Type: boolean
Default: false
Displays the size of every file instead of just the total size.
Type: boolean
Default: false
Displays the gzipped size instead.
Type: string
Default: ''
Give it a title so it's possible to distinguish the output of multiple instances logging at once.
Type: boolean
Default: true
Displays prettified size: 1337 B
→ 1.34 kB
.
Type: number
Example: 12423000
The total size of all files in bytes.
Type: string
Example: '14 kB'
Prettified version of .size
.
Useful for eg. reporting the total project size with gulp-notify
:
var gulp = require('gulp');
var size = require('gulp-size');
var notify = require('gulp-notify');
gulp.task('default', function () {
var s = size();
return gulp.src('fixture.js')
.pipe(s)
.pipe(gulp.dest('dist'))
.pipe(notify({
onLast: true,
message: function () {
return 'Total size ' + s.prettySize;
}
}));
});
MIT © Sindre Sorhus