Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/GoogleChromeLabs/size-plugin

Track compressed Webpack asset sizes over time.
https://github.com/GoogleChromeLabs/size-plugin

bundlesize performance-budget webpack webpack-assets webpack-plugin

Last synced: 3 months ago
JSON representation

Track compressed Webpack asset sizes over time.

Awesome Lists containing this project

README

        



size-plugin
npm


Prints the gzipped sizes of your webpack assets and the changes since the last build.


size-plugin

> 🙋 Using Rollup? Check out the [rollup-plugin-size](https://github.com/luwes/rollup-plugin-size) port.

## Installation

Install `size-plugin` as a development dependency using npm:

```sh
npm i -D size-plugin
```

* * *

## Usage

Add an instance of the plugin to your webpack configuration:

```diff
// webpack.config.js
+ const SizePlugin = require('size-plugin');

module.exports = {
plugins: [
+ new SizePlugin()
]
}
```

* * *

## Options

#### Table of Contents

- [SizePlugin](#sizeplugin)
- [Parameters](#parameters)
- [Item](#item)
- [Properties](#properties)
- [Data](#data)
- [Properties](#properties-1)

### SizePlugin

`new SizePlugin(options)`

#### Parameters

- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**
- `options.pattern` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** minimatch pattern of files to track
- `options.exclude` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** minimatch pattern of files NOT to track
- `options.filename` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** file name to save filesizes to disk
- `options.publish` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** option to publish filesizes to size-plugin-store
- `options.writeFile` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** option to save filesizes to disk
- `options.stripHash` **[function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)?** custom function to remove/normalize hashed filenames for comparison

### Item

#### Properties

- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Filename of the item
- `sizeBefore` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Previous size, in kilobytes
- `size` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Current size, in kilobytes
- `sizeText` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Formatted current size
- `delta` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Difference from previous size, in kilobytes
- `deltaText` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Formatted size delta
- `msg` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Full item's default message
- `color` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The item's default CLI color

### Data

#### Properties

- `sizes` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[Item](#item)>** List of file size items
- `output` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Current buffered output

## License

[Apache 2.0](LICENSE)

This is not an official Google product.