Socket
Socket
Sign inDemoInstall

gulp-size

Package Overview
Dependencies
110
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    gulp-size

Display the size of your project


Version published
Weekly downloads
34K
decreased by-1.54%
Maintainers
1
Install size
1.32 MB
Created
Weekly downloads
 

Readme

Source

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

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

gulp.task('default', function () {
	return gulp.src('fixture.js')
		.pipe(size())
		.pipe(gulp.dest('dist'));
});

API

size([options])

options
showFiles

Type: boolean
Default: false

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

gzip

Type: boolean
Default: false

Displays the gzipped size instead.

title

Type: string
Default: ''

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

pretty

Type: boolean
Default: true

Displays prettified size: 1337 B1.34 kB.

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:

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;
			}
		}));
});

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 17 Aug 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc