• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

sindresorhus/gulp-size: Display the size of your project

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

sindresorhus/gulp-size

开源软件地址(OpenSource Url):

https://github.com/sindresorhus/gulp-size

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

gulp-size

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

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

API

size(options?)

options

Type: object

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.

brotli

Type: boolean
Default: false

Displays the brotli compressed size.

uncompressed

Type: boolean
Default: false if either of gzip or brotli is true, otherwise true

Displays the uncompressed size.

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.

Example

You could, for example, use this to report the total project size with gulp-notify:

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

exports.default = () => {
	const s = size();

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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
jsBoot/gulp-jsdoc: jsDoc plugin adapter for gulp发布时间:2022-06-21
下一篇:
bitpay/bitcore-build: A helper to add tasks to gulp发布时间:2022-06-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap