gulp-size
Display the size of your project
Last updated 9 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm
$ cnpm install gulp-size 
SYNC missed versions from official npm registry.

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, for example, 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

Current Tags

  • 2.1.0                                ...           latest (9 years ago)

1 Versions

  • 2.1.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (7)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org