Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xelzs/code-size
Estimates the size of your files in different format (original, minified, gzipped, brotli).
https://github.com/xelzs/code-size
brotli css estimation gzip minify scss size-calculation size-coding sizes tool
Last synced: about 2 months ago
JSON representation
Estimates the size of your files in different format (original, minified, gzipped, brotli).
- Host: GitHub
- URL: https://github.com/xelzs/code-size
- Owner: Xelzs
- License: mit
- Created: 2020-08-14T14:48:41.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-23T16:02:24.000Z (about 4 years ago)
- Last Synced: 2024-11-12T11:40:14.630Z (about 2 months ago)
- Topics: brotli, css, estimation, gzip, minify, scss, size-calculation, size-coding, sizes, tool
- Language: JavaScript
- Homepage:
- Size: 51.8 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# CodeSize
[![Maintainability](https://api.codeclimate.com/v1/badges/0926045450cb16d6e423/maintainability)](https://codeclimate.com/github/Xelzs/code-size/maintainability)
Estimates the size of your files in different format (original, minified, gzipped, brotli).
## Command-line Usage
Install code-size package globally with npm :
```
$ npm install -g @xelzs/code-size
```Basic usage :
```
$ code-size -f test.css -gbm --language cssCodeSize | Version 1.0.0
Original size : 9.11 KB
Minified size : 7.16 KB
Gzipped size : 140 Bytes
Brotli size : 82 Bytes
```Available options :
```
Usage: code-size [options]Options:
-V, --version output the version number
-s, --sourcespecify raw source code
-f, --file specify path to a file
-g, --gzip show gzipped size
-b, --brotli show brotli size
-m, --minify show minified size | !! Works only with supported language !!
-l, --language specifies the language type. Supported: css, sass, scss, js (default: "css")
-h, --help display help for command
```## Programmatic Usage
Install with npm :
```
$ npm install --save @xelzs/code-size
```Get all sizes :
```js
const {size} = require('code-size');const data = size({
file: 'test.css',
gzip: true,
brotli: true,
minify: true,
language: 'css',
});console.log(data);
// {
// original: '9.11 KB',
// minify: '7.16 KB',
// gzip: '140 Bytes',
// brotli: '82 Bytes',
// }
```### Options
All options availables on command-line are also available here.- `source` - Raw source code
- `file` - Path to a file
- `gzip` - Boolean to enable the gzip estimation
- `brotli` - Boolean to enable the brotli estimation
- `minify` - Boolean to enable the minify estimation. **Language option required**
- `language` - Specify the language type. Supported: `css`, `sass`, `scss`, `js`.## Changelog
Changelog is accessible in the [CHANGELOG.md](CHANGELOG.md) file or in [the release section](https://github.com/Xelzs/code-size/releases).