This application accelerates a Ghost Blog by optimizing assets, and improves Lighthouse scores dramatically. It works out of the box for the default Casper theme and can be easily modified to support other themes.
Google Lighthouse measures user perceived application performance, and assigns a score of 0-100 (100 is good, 0 is gross).
The Casper theme is well designed and loads JavaScript + Style assets intelligently. This app primarily optimizes images:
- Serves webp when browsers send an
Accept: image/webp
header - Resizes images in listings to fit the styles
- Adds
srcset
attributes to image tags, which defines multiple sizes of the same image, allowing the browser to appropriately select which image source to use based on device size
- First, make sure you have the latest version of Fly installed by running
npm i -g @fly/fly
git clone https://github.com/superfly/ghost-accelerator.git
cd ghost-accelerator
fly server
- Visit http://localhost:3000 to view the app
You should see the "demo" version of a Ghost blog (https://demo.ghost.io/)
- Navigate to the
index.js
file and changeconst subdomain
from"demo"
to your own Ghost Blog's name - Save and visit http://localhost:3000 again
You should now see your own Ghost Blog with properly sized, optimized images in the WebP format! Run a Lighthouse audit and see for yourself just how well your blog is performing .. and then, deploy!
- Run
fly login
(make sure you have a Fly account first, if you don’t, register at https://fly.io/app/sign-up) - Run
fly apps create <app-name>
to create a Fly Edge App - Then run
fly deploy
to deploy your Fly Edge App