Firebase Hosting
Firebase Hosting serves static content from a global CDN. pageflare runs as a post-build step before firebase deploy, optimizing your site’s HTML, CSS, JS, and fonts.
How It Works
Section titled “How It Works”Add pageflare to your package.json build script. Firebase CLI deploys whatever is in your configured public directory — pageflare optimizes those files in place before the deploy happens.
Step 1 — Install pageflare
Section titled “Step 1 — Install pageflare”npm install -D @pageflare/cliStep 2 — Configure the Build
Section titled “Step 2 — Configure the Build”Update your package.json build script to include pageflare:
{ "scripts": { "build": "astro build && npx @pageflare/cli dist/ --in-place --no-progress", "deploy": "npm run build && firebase deploy" }}Make sure firebase.json points to the correct output directory:
{ "hosting": { "public": "dist", "ignore": ["firebase.json", "**/.*", "**/node_modules/**"] }}Step 3 — Pro License
Section titled “Step 3 — Pro License”Set PAGEFLARE_LICENSE in your CI environment, or locally via .env:
# Local developmentexport PAGEFLARE_LICENSE=your-license-key
# GitHub Actions# Add as a repository secret, then reference in your workflowStep 4 — Verify
Section titled “Step 4 — Verify”After building, check the terminal output for the pageflare summary:
Done 145.2 KB saved (38.1%) 1.2s Files 42 total, 38 optimized, 4 unchanged, 0 errorsFramework Output Directories
Section titled “Framework Output Directories”| Framework | Output directory | firebase.json public |
|---|---|---|
| Astro | dist/ | dist |
| Next.js static export | out/ | out |
| Hugo | public/ | public |
| Vite | dist/ | dist |
| Docusaurus | build/ | build |
Troubleshooting
Section titled “Troubleshooting”pageflare processes 0 files The directory in your build script doesn’t match where your framework writes output. Check the table above and update accordingly.
Deploy includes unoptimized files
Make sure pageflare runs before firebase deploy, not after. The --in-place flag overwrites the files so Firebase deploys the optimized versions.