# prepa

> A utility for preparing static assets

Latest version **1.0.4** (published 2024-05-03) · Zlib license · 0 weekly downloads

## Install

```sh
npm install prepa
pnpm add prepa
yarn add prepa
bun add prepa
```

Provides the command `prepa`.

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2024-05-03 |
| First published | 2020-04-27 |
| Weekly downloads | 0 |
| License | Zlib |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 3 |
| Unpacked size | 17.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | lezgomatt |
| Maintainers | lezgomatt |

## Links

- npm: https://www.npmjs.com/package/prepa
- Repository: https://github.com/lezgomatt/prepa
- Homepage: https://github.com/lezgomatt/prepa#readme
- Issues: https://github.com/lezgomatt/prepa/issues
- npm.io page: https://npm.io/package/prepa

## Dependencies (3)

- [csso](https://npm.io/package/csso.md) ^5.0.5
- [svgo](https://npm.io/package/svgo.md) ^3.2.0
- [terser](https://npm.io/package/terser.md) ^5.31.0

## Recent versions

- 1.0.4 (latest) — 2024-05-03
- 1.0.3 — 2020-09-28
- 1.0.2 — 2020-04-28
- 1.0.1 — 2020-04-27
- 1.0.0 — 2020-04-27

## README

# prepa

A utility for preparing static assets.

Get in on npm: `npm install -g prepa` or `yarn global add prepa`


## Features

- `prepa min` - minify your static assets (CSS, JS, SVG)
- `prepa zip` - precompress your static assets (Gzip, Brotli)
- `prepa hash` - fingerprint your static assets (for cache busting) with automatic reference fixing


## Limitations

- Image optimization is not provided (except for SVG) since it is difficult to automate the following:
  - resizing images based on its actual size on the page
  - the use of multiple image sizes and formats (separate high-DPI versions, WebP with fallback)
  - greater compression (often lossy, which requires subjective judgment)

- Fixing references (after fingerprinting) is limited to the following:
  - `href`, `src`, and `srcset` attributes in HTML
  - `url` functions in CSS (inline styles are not included)

**NOTE:**
When fixing references, the specified directory is assumed to be the root.
References are detected via regular expressions, and no actual parsing is done.
This should be sufficient for most cases, but if you wish to handle the fixing yourself,
use `prepa rename` to skip automatic fixing and generate a `prepa-renames.json` file instead.


## Implementation Details

- Minification uses the following libraries:
  [`csso`](https://github.com/css/csso) for CSS,
  [`terser`](https://github.com/terser/terser) for JS,
  [`svgo`](https://github.com/svg/svgo) for SVG

- Compression uses the built-in `zlib` module of Node.js and is always done at the max level
  (Brotli support requires Node.js v11.7.0 or later)
- Only CSS, HTML, JS, JSON, SVG, TXT, and XML files are included for compression
  (other file formats are expected to already be in a compressed format)

- Asset fingerprinting uses BLAKE2b-512 as its hash function,
  and truncates it to 16 base64 characters (96 bits)
- HTML, JSON, TXT, and XML files are all excluded from fingerprinting

---
_Source: https://npm.io/package/prepa · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
