Skip to content

Gridsome

Gridsome is a Vue-based static site generator powered by GraphQL. It outputs a fully static site to dist/ by default. pageflare integrates as a post-build step via npm scripts.

Terminal window
npm install -D @pageflare/cli

Chain pageflare after gridsome build in your npm scripts:

package.json
{
"scripts": {
"build": "gridsome build && pageflare dist/ --in-place"
}
}

Create a pageflare.jsonc in your project root:

pageflare.jsonc
{
"minify_html": true,
"minify_css": true,
"minify_js": true,
"js_defer": true,
"lazy_images": true,
"img_dimensions": true,
"font_swap": true,
"preconnect_hints": true
}

Gridsome handles image processing via g-image and minifies JS/CSS via webpack, but does not optimize the final HTML output. pageflare adds:

  • HTML minification
  • Lazy loading for images not using g-image
  • JavaScript defer and loader injection
  • Font display swap and self-hosting
  • Preconnect hints for third-party origins
  • Critical CSS extraction (Pro)
  • Responsive image srcset generation (Pro)
.github/workflows/build.yml
- name: Build Gridsome
run: gridsome build
- name: Optimize with pageflare
uses: getappz/pageflare-cli@v1
with:
args: "dist/ --in-place"
netlify.toml
[build]
command = "gridsome build && pageflare dist/ --in-place --no-progress"
publish = "dist"
vercel.json
{
"buildCommand": "gridsome build && pageflare dist/ --in-place --no-progress"
}

Gridsome has built-in image optimization via @gridsome/plugin-image. After adding pageflare:

Feature / Pluginpageflare equivalent
gridsome-plugin-sitemap / @gridsome/plugin-sitemapSitemap generation via llm.sitemap config
Third-party minification pluginsHTML, CSS, JS minification

Set the PAGEFLARE_LICENSE environment variable to unlock Pro optimizations:

Terminal window
PAGEFLARE_LICENSE=your-key npm run build

Gridsome static output works with any hosting provider:

JS defer breaks client-side navigation Gridsome uses Vue Router for client-side routing. If deferred scripts interfere with page transitions, disable JS deferral:

{ "js_defer": false }

Duplicate image optimization If you use Gridsome’s g-image component, images already have lazy loading and srcset. pageflare skips images that already have these attributes. The two work safely together.

pageflare processes 0 files Verify the output directory — Gridsome defaults to dist/. Check that the build completed successfully before pageflare runs.