build-size
v0.4.0
Published
Parse and compare build sizes
Downloads
10
Readme
build-size
Parse and compare build size
Install
Install locally with npm:
$ npm install --save-dev build-size
Install globally with npm:
$ npm install --global build-size
Basic usage
Locally with npm:
# Display help
$ npm run build-size -- --help
# Parse
$ npm run build-size -- parse ./previous/**/*.js ./previous/**/*.css > previous.json
$ npm run build-size -- parse ./new/**/*.js ./new/**/*.css > new.json
# Compare
$ npm run build-size -- compare previous.json new.json
Globally:
# Display help
$ build-size --help
# Parse
$ build-size parse ./previous/**/*.js ./previous/**/*.css > previous.json
$ build-size parse ./new/**/*.js ./new/**/*.css > new.json
# Compare
$ build-size compare previous.json new.json
Example output
Parse:
$ build-size parse js/*.js css/*.css
{
"js/app.js": 133104,
"js/manifest.js": 1478,
"js/vendor.js": 466292,
"css/app.css": 24491
}
Compare:
$ build-size compare previous.json new.json
This change will increase the build size from 610.71 KB to 616.04 KB, an increase of 5.33 KB \(1%\)
File name | Previous size | New size | Change
--- | --- | --- | ---
js\/app.js | 129.98 KB | 135.32 KB | ![▲](https://swisnl.github.io/build-size/images/increase.svg "Increase") 5.33 KB \(4%\)
js\/manifest.js | 1.44 KB | 1.45 KB | ![▲](https://swisnl.github.io/build-size/images/increase.svg "Increase") 2 B \(0%\)
js\/vendor.js | 455.36 KB | 455.36 KB | 0 B \(0%\)
css\/app.css | 23.92 KB | 23.92 KB | 0 B \(0%\)
Testing
$ npm test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
Inspired by BuildSize and similar projects, such as bundlesize and Size Limit.
License
The MIT License (MIT). Please see License File for more information.
SWIS
SWIS is a web agency from Leiden, the Netherlands. We love working with open source software.