Revela

Static Compression

Revela can pre-compress your static files with Gzip and Brotli for faster loading.

Do you need this? If you're using GitHub Pages, Netlify, Vercel, or Cloudflare Pages โ€“ no! These platforms compress automatically. This plugin is for self-hosted servers, AWS S3, or basic web hosts.

Overview

๐Ÿ“ฆ Pre-Generated

Compressed files created at build time, not on every request.

๐Ÿš€ About 80% Smaller

HTML, CSS, and JS files shrink a lot with Brotli: about 80% for this website's own pages (HTML โˆ’80%, CSS โˆ’78%, JS โˆ’69%).

โšก No Work per Request

Servers send the pre-compressed files as they are instead of compressing every request.

Installation

The Standalone edition has Compress built in. In the Full edition, install it from the bundled packages:

revela plugin install Compress

Usage

Compress Your Site

# After generating your site
revela generate compress

Note: Compression runs separately, not as part of generate all. Your server must be configured to serve pre-compressed files.

In a terminal, compression shows a live progress bar; in CI logs or redirected output it prints plain progress lines instead (one about every 10 %).

Running it again only compresses what changed. Revela keeps a .gz/.br file when the page it was made from has exactly the same content as last time and the compressed file itself is untouched; everything else is compressed again. The summary shows how many files were compressed and how many were unchanged.

Note: revela generate pages (and therefore generate all) removes all compressed files before it writes new pages, so no outdated .gz/.br file can be served. After such a build, the next revela generate compress compresses everything again.

The local revela serve preview server automatically negotiates existing .br and .gz variants using the browser's Accept-Encoding header. Production servers still need their equivalent static Brotli/Gzip configuration.

Remove Compressed Files

revela clean compress

What Gets Compressed?

File Type Typical Savings
HTML 70-85%
CSS 75-90%
JavaScript 65-80%
JSON 70-85%
SVG 50-70%
XML 70-85%

Images are skipped โ€“ they're already optimized (AVIF, WebP, JPG).

Output Structure

Your files remain unchanged. Compressed versions are added alongside:

output/
โ”œโ”€โ”€ index.html          โ† Original (10 KB)
โ”œโ”€โ”€ index.html.gz       โ† Gzip (2.5 KB)
โ”œโ”€โ”€ index.html.br       โ† Brotli (2.1 KB)
โ”œโ”€โ”€ _assets/
โ”‚   โ”œโ”€โ”€ main.css
โ”‚   โ”œโ”€โ”€ main.css.gz
โ”‚   โ””โ”€โ”€ main.css.br

Revela remembers which .gz and .br files it created in .revela/compress/ownership.json in your project, not in the output, so that record is never uploaded with your site. Together with each file it stores a fingerprint of the page it was compressed from, which is how it recognises unchanged pages. revela clean compress removes only those files and never touches other .gz/.br files you put there yourself.

Example Output

โ•ญโ”€Successโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Compression complete!              โ”‚
โ”‚                                    โ”‚
โ”‚ Summary:                           โ”‚
โ”‚   Files:      14                   โ”‚
โ”‚   Compressed: 3                    โ”‚
โ”‚   Unchanged:  11                   โ”‚
โ”‚   Original:   1.22 MB              โ”‚
โ”‚                                    โ”‚
โ”‚ Compressed sizes:                  โ”‚
โ”‚   Gzip:    93.4 KB (92.5% savings) โ”‚
โ”‚   Brotli:  61.6 KB (95.1% savings) โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

When Do You Need This Plugin?

Platform Need Plugin? Reason
GitHub Pages โŒ No Compresses automatically
Netlify โŒ No Compresses automatically
Vercel โŒ No Compresses automatically
Cloudflare Pages โŒ No Compresses automatically
AWS S3 + CloudFront ๐ŸŸก Optional CloudFront compresses, but pre-compressed is faster
AWS S3 (direct) โœ… Yes No automatic compression
nginx โœ… Yes Use gzip_static on for pre-compressed files
Apache โš™๏ธ Needs RewriteRule

Pipeline Order

Compression is not part of revela generate all. Run it separately after generating your site:

revela generate all
revela generate compress

This ensures all content exists before compressing.

Compression Settings

The plugin uses maximum compression for smallest files:

Format Level Browser Support
Gzip 9 (max) All browsers
Brotli 11 (max) Modern browsers (95%+)

Files under 256 bytes are skipped โ€“ compression overhead exceeds savings.

Server Configuration

Pre-compressed files only help if your server serves them. Point your server at the .gz / .br files:

nginx

gzip_static on;
brotli_static on;   # requires the ngx_brotli module

Apache

# Serve .br to Brotli-capable browsers
RewriteCond %{HTTP:Accept-Encoding} br
RewriteCond %{REQUEST_FILENAME}.br -f
RewriteRule ^(.*)$ $1.br [L]

# Serve .gz to Gzip-capable browsers
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.gz -f
RewriteRule ^(.*)$ $1.gz [L]

Caddy / GitHub Pages / Netlify / Cloudflare Pages

These serve pre-compressed files automatically โ€“ no configuration needed.