UNPKG

1.68 kBMarkdownView Raw
1# precompress
2[![](https://img.shields.io/npm/v/precompress.svg?style=flat)](https://www.npmjs.org/package/precompress) [![](https://img.shields.io/npm/dm/precompress.svg)](https://www.npmjs.org/package/precompress) [![](https://packagephobia.com/badge?p=precompress)](https://packagephobia.com/result?p=precompress)
3
4> Generate pre-compressed .gz and .br files for static web servers
5
6Compresses files for use with web servers like nginx with the `gzip_static` and `brotli_static` directives. Files are compressed in parallel, using the available CPU cores efficiently. Existing output files will always be overridden.
7
8## Usage
9```bash
10# compress all files in the "build" directory
11npx precompress ./build
12
13# same with bun
14bunx precompress ./build
15```
16
17## Options
18```
19usage: precompress [options] <files,dirs,...>
20
21 Options:
22 -t, --types <type,...> Types of files to generate. Default: gz,br
23 -c, --concurrency <num> Number of concurrent operations. Default: auto
24 -i, --include <ext,...> Only include given file extensions. Default: unset
25 -e, --exclude <ext,...> Exclude given file extensions. Default: gz,br
26 -m, --mtime Skip creating existing files when source file is newer
27 -f, --follow Follow symbolic links
28 -s, --silent Do not print anything
29 -S, --sensitive Treat include and exclude patterns case-sensitively
30 -V, --verbose Print individual file compression times
31 -h, --help Show this text
32 -v, --version Show the version
33
34 Examples:
35 $ precompress ./build
36```
37
38© [silverwind](https://github.com/silverwind), distributed under BSD licence