Skip to content

Configuration

pageflare is configured through a pageflare.jsonc file in your input directory. All options have sensible defaults — the config file is optional unless you want to customize behavior.

Run pageflare init to generate a fully-commented config file with every option set to its default value:

Terminal window
pageflare init
pageflare init dist/

This writes pageflare.jsonc in the target directory. Edit it to suit your site.

The file uses JSONC (JSON with comments). You can use // and /* */ comments freely:

{
// Minification
"minify_html": true,
"minify_css": true,
"minify_js": true
}

pageflare looks for the config file at <input>/pageflare.jsonc. To use a different path, pass -c / --config:

Terminal window
pageflare dist/ --config ./config/pageflare.jsonc

Control whether HTML, CSS, and JavaScript are minified.

OptionTypeDefaultDescription
minify_htmlbooleantrueMinify HTML files — collapse whitespace, remove optional tags and comments
minify_cssbooleantrueMinify CSS — remove whitespace, shorten values, deduplicate rules
minify_jsbooleantrueMinify JavaScript — remove whitespace, shorten identifiers, tree-shake dead code
{
"minify_html": true,
"minify_css": true,
"minify_js": true
}

Control how JavaScript is deferred to improve initial page load.

OptionTypeDefaultDescription
js_deferbooleantrueDefer non-critical JavaScript until after the page is interactive
js_defer_methodstring"user-interaction"When to load deferred scripts: "user-interaction" (first scroll/click/keypress) or "defer" (standard HTML defer)
js_defer_excludesstring[][]Array of script URL patterns to exclude from deferral (substring match)
js_defer_timeoutnumber10000Fallback timeout in milliseconds — deferred scripts load after this delay even without user interaction
{
"js_defer": true,
"js_defer_method": "user-interaction",
"js_defer_excludes": [
"analytics.js",
"/critical/"
],
"js_defer_timeout": 10000
}

js_defer_method values:

  • "user-interaction" — Scripts load on the first user interaction (scroll, click, or keypress), with js_defer_timeout as a fallback. This maximizes Time to Interactive (TTI) improvement.
  • "defer" — Uses the standard HTML defer attribute. Scripts run after the document is parsed but do not wait for user interaction.

js_defer_excludes accepts partial URL strings. Any script whose src contains a listed substring is excluded from deferral:

{
"js_defer_excludes": [
"stripe.js", // Payment scripts that must load immediately
"/vendor/init" // Initialisation scripts required on first paint
]
}

Control lazy loading and automatic dimension injection for images and iframes.

OptionTypeDefaultDescription
lazy_load_imagesbooleantrueAdd loading="lazy" to images below the fold
lazy_load_iframesbooleantrueAdd loading="lazy" to iframes
lazy_load_excludesstring[][]Array of image URL patterns to exclude from lazy loading
add_image_dimensionsbooleantrueDetect and inject width and height attributes on <img> tags that are missing them, preventing layout shift (CLS)
image_cdnstring"optimize"Control CDN image optimization behavior: "optimize" or "off"
{
"lazy_load_images": true,
"lazy_load_iframes": true,
"lazy_load_excludes": [
"logo.png",
"/hero/"
],
"add_image_dimensions": true
}

Images near the top of the page (above the fold) are automatically excluded from lazy loading regardless of lazy_load_excludes.


OptionTypeDefaultDescription
font_display_swapbooleantrueInject font-display: swap into @font-face rules so text remains visible while custom fonts load
self_host_google_fontsbooleantruePRO Download Google Fonts and serve them from your own domain, eliminating the third-party DNS lookup
font_unicode_rangebooleantruePRO Generate unicode-range descriptors for self-hosted fonts to avoid loading character sets not used on the page
font_subsetbooleantruePRO Subset font files to only include characters used on the site, then re-encode as WOFF2
{
"font_display_swap": true,
// Pro features
"self_host_google_fonts": true,
"font_unicode_range": true,
"font_subset": true
}

Download and self-host third-party analytics scripts to eliminate external requests.

OptionTypeDefaultDescription
self_host_analyticsbooleanfalsePRO Download and self-host analytics scripts (Google Analytics, Plausible, Fathom, Umami, Matomo)
analytics_minimalbooleanfalsePRO Strip unnecessary tracking features from analytics scripts to reduce size
analytics_cookielessbooleanfalsePRO Remove cookie-based tracking for GDPR compliance
analytics_randomize_idbooleanfalsePRO Randomize analytics client IDs for enhanced privacy
analytics_adblocker_detectbooleanfalsePRO Enable fallback when analytics is blocked by adblockers
{
// Pro features
"self_host_analytics": true,
"analytics_minimal": false,
"analytics_cookieless": false,
"analytics_randomize_id": false,
"analytics_adblocker_detect": false
}

OptionTypeDefaultDescription
optimize_svgbooleantrueOptimize inline SVGs — remove editor metadata, comments, and redundant attributes
{
"optimize_svg": true
}

Build-time image optimization with format conversion and responsive variants.

OptionTypeDefaultDescription
optimize_imagesbooleantruePRO Generate optimized image variants at build time
image_formatsstring[]["webp"]Target formats for conversion (e.g., ["webp", "avif"])
image_widthsnumber[][320, 640, 960, 1280, 1920]Breakpoint widths for responsive srcset generation
image_qualitynumber80Encoding quality (1–100) for lossy formats
{
// Pro features
"optimize_images": true,
"image_formats": ["webp"],
"image_widths": [320, 640, 960, 1280, 1920],
"image_quality": 80
}

OptionTypeDefaultDescription
preconnect_hintsbooleantrueInject <link rel="preconnect"> for third-party origins detected in the page, reducing connection latency
speculation_rulesbooleantruePRO Inject the Speculation Rules API to prerender likely-next pages in supporting browsers
spa_modebooleantruePRO Enable single-page app navigation using the View Transitions API for instant client-side page changes
{
"preconnect_hints": true,
// Pro features
"speculation_rules": true,
"spa_mode": true
}

OptionTypeDefaultDescription
critical_cssbooleantruePRO Extract and inline above-the-fold CSS, then load the full stylesheet asynchronously to eliminate render-blocking CSS
{
// Pro feature
"critical_css": true
}

OptionTypeDefaultDescription
platformstring"auto"Deployment platform: "auto", "vercel", "netlify", "cloudflare-pages", or "none"
{
"platform": "auto"
}

OptionTypeDefaultDescription
defer_background_imagesbooleantruePRO Defer off-screen CSS background images using IntersectionObserver
youtube_facadesbooleantruePRO Replace YouTube embeds with lightweight click-to-load facades, eliminating ~500 KB of third-party JavaScript on initial load
remove_wp_bloatbooleantruePRO Remove WordPress-specific bloat: emoji scripts, redundant meta tags, and unused query strings
wp_hide_pathsbooleantruePRO Sanitize WordPress paths in static exports: rename wp-contentcontent, wp-includesincludes, remove wp-admin
partytownbooleanfalsePRO Offload third-party scripts to a Web Worker using Partytown
hash_filenamesbooleantruePRO Append content hashes to asset filenames for long-term cache control, then update all references in HTML and CSS
{
// Pro features
"defer_background_images": true,
"youtube_facades": true,
"remove_wp_bloat": false, // Disable if not a WordPress site
"wp_hide_paths": true,
"partytown": false,
"hash_filenames": true
}

A config file with all options explicit (as generated by pageflare init):

{
// ── Minification ─────────────────────────────────────────
"minify_html": true,
"minify_css": true,
"minify_js": true,
// ── JavaScript Loading ────────────────────────────────────
"js_defer": true,
"js_defer_method": "user-interaction",
"js_defer_excludes": [],
"js_defer_timeout": 10000,
// ── Images ────────────────────────────────────────────────
"lazy_load_images": true,
"lazy_load_iframes": true,
"lazy_load_excludes": [],
"add_image_dimensions": true,
"optimize_images": true, // Pro
"image_formats": ["webp"], // Pro
"image_widths": [320, 640, 960, 1280, 1920], // Pro
"image_quality": 80, // Pro
// ── Fonts ─────────────────────────────────────────────────
"font_display_swap": true,
"self_host_google_fonts": true, // Pro
"font_unicode_range": true, // Pro
"font_subset": true, // Pro
// ── Analytics ─────────────────────────────────────────────
"self_host_analytics": false, // Pro
"analytics_minimal": false, // Pro
"analytics_cookieless": false, // Pro
"analytics_randomize_id": false, // Pro
"analytics_adblocker_detect": false, // Pro
// ── SVG ───────────────────────────────────────────────────
"optimize_svg": true,
// ── Performance Hints ─────────────────────────────────────
"preconnect_hints": true,
"speculation_rules": true, // Pro
"spa_mode": true, // Pro
// ── CSS ───────────────────────────────────────────────────
"critical_css": true, // Pro
// ── Platform ──────────────────────────────────────────────
"platform": "auto",
// ── Other ─────────────────────────────────────────────────
"defer_background_images": true, // Pro
"youtube_facades": true, // Pro
"remove_wp_bloat": true, // Pro
"wp_hide_paths": true, // Pro
"partytown": false, // Pro
"hash_filenames": true, // Pro
// ── Sitemap ───────────────────────────────────────────────
"sitemap": {
"enabled": null,
"base_url": null,
"changefreq": "weekly",
"priority": 0.5,
"exclude": ["404.html"]
},
// ── LLM Files ─────────────────────────────────────────────
"llm": {
"enabled": null,
"theme": "structured",
"base_url": null,
"site_name": null,
"sub_indexes": [],
"robots_policy": "allow-all",
"content_signals": {}
}
}

Pro-only options are silently ignored on the Free tier — you can leave them set to true in your config without causing errors.


Automatic sitemap.xml generation with lastmod dates and gzip compression.

OptionTypeDefaultDescription
sitemap.enabledboolean/nullnullEnable sitemap generation (null = auto, based on tier)
sitemap.base_urlstring/nullnullBase URL for the site (e.g., "https://example.com") — required for absolute URLs
sitemap.changefreqstring"weekly"Default change frequency: "always", "hourly", "daily", "weekly", "monthly", "yearly", "never"
sitemap.prioritynumber0.5Default priority for pages (0.0 to 1.0)
sitemap.includestring[][]Glob patterns to include (empty = all pages)
sitemap.excludestring[]["404.html"]Glob patterns to exclude
{
"sitemap": {
"enabled": null,
"base_url": "https://example.com",
"changefreq": "weekly",
"priority": 0.5,
"include": [],
"exclude": ["404.html"]
}
}

Control generation of llms.txt files for LLM-friendly site indexing.

OptionTypeDefaultDescription
llm.enabledboolean/nullnullEnable llms.txt generation (null = auto, based on tier)
llm.themestring"structured"Output theme for llms.txt
llm.base_urlstring/nullnullBase URL prepended to paths
llm.site_namestring/nullnullSite name for the llms.txt header
llm.sub_indexesstring[][]Folder prefixes that get their own llms.txt (e.g., ["docs", "api"])
llm.robots_policystring"allow-all"Robots.txt policy preset: "allow-all", "block-ai-training", "block-all-ai", "block-all"
llm.content_signalsobject{}Per-signal overrides: { "search": "yes"/"no", "ai_input": "yes"/"no", "ai_train": "yes"/"no" }
{
"llm": {
"enabled": null,
"theme": "structured",
"base_url": null,
"site_name": null,
"sub_indexes": [],
"robots_policy": "allow-all",
"content_signals": {}
}
}