Introduction
Pageflare is a post-build optimizer for static sites. After your site generator (Astro, Next.js, Hugo, WordPress, or any other tool) produces its output, pageflare processes those files and applies a suite of performance optimizations — all without touching your source code.
The result: higher PageSpeed / Lighthouse scores, smaller payloads, and better Core Web Vitals, in a single CLI command.
What pageflare does
Section titled “What pageflare does”Pageflare reads your site’s output directory and rewrites HTML, CSS, JavaScript, and font references in place. It does not change your source files and does not require a build-step plugin.
HTML, CSS, and JavaScript
Section titled “HTML, CSS, and JavaScript”- HTML minification — strips whitespace, comments, and redundant attributes.
- CSS minification — removes unused rules, collapses shorthand properties, and eliminates dead code.
- JS minification — minifies and tree-shakes JavaScript bundles.
- JS deferral — moves render-blocking
<script>tags to the end of<body>or addsdefer/asyncattributes. - Lazy loading — adds
loading="lazy"to below-the-fold images and iframes. - Preconnect hints — injects
<link rel="preconnect">for third-party origins detected in the markup.
Images
Section titled “Images”- Image dimensions — reads each
<img>and adds missingwidth/heightattributes to prevent layout shift (CLS). - Platform images — rewrites image URLs to use platform-native image CDNs (Cloudflare Images, Vercel Image Optimization) when available. (Pro)
- Defer background images — converts CSS
background-imagedeclarations to lazy-loaded equivalents. (Pro)
- Font display swap — adds
font-display: swapto all@font-facedeclarations, eliminating invisible-text flash (FOIT). - Self-host Google Fonts — downloads Google Fonts at build time and rewrites references to serve them from your own origin. (Pro)
- Unicode-range subsetting — adds
unicode-rangedescriptors so browsers only download character subsets they need. (Pro)
Advanced (Pro)
Section titled “Advanced (Pro)”- Critical CSS — extracts and inlines above-the-fold CSS, then lazy-loads the rest. (Pro)
- SPA mode — enables client-side navigation with prefetching via the Navigation API. (Pro)
- Speculation rules — injects the Speculation Rules API for instant page transitions. (Pro)
- YouTube facades — replaces
<iframe>YouTube embeds with lightweight click-to-load facades. (Pro) - WordPress bloat removal — strips WP-specific render-blocking scripts and styles (emoji JS, query string versioning, etc.). (Pro)
- Hash filenames — content-hashes asset filenames for aggressive long-term caching. (Pro)
Free vs Pro
Section titled “Free vs Pro”| Feature | Free | Pro |
|---|---|---|
HTML minificationStrips whitespace and redundant attributes from HTML files. | ✓ | ✓ |
CSS minificationRemoves unused rules and collapses shorthand properties. | ✓ | ✓ |
JS minificationMinifies and tree-shakes JavaScript bundles. | ✓ | ✓ |
JS deferralAdds defer/async to render-blocking scripts. | ✓ | ✓ |
Lazy load imagesAdds loading="lazy" to below-the-fold images. | ✓ | ✓ |
Lazy load iframesAdds loading="lazy" to below-the-fold iframes. | ✓ | ✓ |
Image dimensionsReads image files and injects missing width/height attributes. | ✓ | ✓ |
Font display swapAdds font-display: swap to all @font-face rules. | ✓ | ✓ |
Preconnect hintsInjects <link rel="preconnect"> for detected third-party origins. | ✓ | ✓ |
Critical CSSExtracts and inlines above-the-fold CSS for faster first paint. | — | ✓ |
Self-host Google FontsDownloads and serves fonts from your own origin. | — | ✓ |
Unicode-range subsettingAdds unicode-range so browsers only fetch needed character sets. | — | ✓ |
SPA modeEnables client-side navigation with prefetching. | — | ✓ |
Speculation rulesInjects Speculation Rules API for instant page transitions. | — | ✓ |
YouTube facadesReplaces iframe embeds with lightweight click-to-load facades. | — | ✓ |
WordPress bloat removalRemoves WP-specific render-blocking scripts and styles. | — | ✓ |
Platform imagesRewrites image URLs to use platform-native CDNs. | — | ✓ |
Defer background imagesLazy-loads CSS background-image declarations. | — | ✓ |
Hash filenamesContent-hashes asset filenames for long-term caching. | — | ✓ |
Where to go next
Section titled “Where to go next”- Quick Start — be up and running in two minutes.
- Installation — all installation methods including npm, Homebrew, curl, and Docker.
- First Optimization — a guided walkthrough of your first real run.
- Platform Guides — integration instructions for Cloudflare Pages, Vercel, WordPress, and more.