Display the size of your project
JavaScript
Latest commit 1303830 Mar 10, 2016 @sindresorhus 2.1.0
Permalink
Failed to load latest commit information.
.editorconfig tweaks Mar 10, 2016
.gitattributes fix screenshot Apr 3, 2014
.gitignore init Jan 3, 2014
.travis.yml tweaks Mar 10, 2016
index.js tweaks Mar 10, 2016
license tweaks Sep 1, 2014
package.json 2.1.0 Mar 10, 2016
readme.md tweaks Mar 10, 2016
screenshot.png update screenshot Sep 1, 2014
test.js add XO Aug 17, 2015

readme.md

gulp-size Build Status

Display the size of your project

Logs out the total size of files in the stream and optionally the individual file-sizes.

Install

$ npm install --save-dev gulp-size

Usage

const gulp = require('gulp');
const size = require('gulp-size');

gulp.task('default', () =>
    gulp.src('fixture.js')
        .pipe(size())
        .pipe(gulp.dest('dist'))
);

API

size([options])

options

title

Type: string
Default: ''

Give it a title so it's possible to distinguish the output of multiple instances logging at once.

gzip

Type: boolean
Default: false

Displays the gzipped size instead.

pretty

Type: boolean
Default: true

Displays prettified size: 1337 B1.34 kB.

showFiles

Type: boolean
Default: false

Displays the size of every file instead of just the total size.

showTotal

Type: boolean
Default: true

Displays the total of all files.

size.size

Type: number
Example: 12423000

The total size of all files in bytes.

size.prettySize

Type: string
Example: '14 kB'

Prettified version of .size.

Useful for eg. reporting the total project size with gulp-notify:

const gulp = require('gulp');
const size = require('gulp-size');
const notify = require('gulp-notify');

gulp.task('default', () => {
    const s = size();

    return gulp.src('fixture.js')
        .pipe(s)
        .pipe(gulp.dest('dist'))
        .pipe(notify({
            onLast: true,
            message: () => `Total size ${s.prettySize}`
        }));
});

License

MIT © Sindre Sorhus