Presented by Brian Gershon
JAMstack is client-side JavaScript + APIs + Markup
My evolution of JAMstack tools over the years.
A very nice JAMstack framework.
"Eleventy facilitates JAMstack sites — but you maintain full control over the JavaScript."
https://www.11ty.dev/docs/
Walk through a minimal Eleventy site.
Walking through some real-life examples while creating briangershon.com site.
tags
For blog listing, crop blog entry's 800 x 240 slice out. (generate-blog-slices.js
)
// sample extractParams:
{ left: 0, top: 0, width: 800, height: 240 }
async function saveSliceToFS(inputPath, outputPath, extractParams) {
return pipeline(
fs.createReadStream(inputPath),
sharp()
.resize(800, null, { withoutEnlargement: true })
.extract(extractParams)
.jpeg(),
fs.createWriteStream(outputPath)
).then(()=>{
console.log(`Wrote (image) ${outputPath} with crop of ${JSON.stringify(extractParams)}`);
});
}
_data/siteData.js
)_data/bookmarks.js
)generate-bookmarks.js
)Built in pagination example
layout: base.njk
pagination:
data: bookmarks.data
size: 100
title: Bookmarks
---
Bookmarks
Interesting sites.
...
Netlify has time-limit on "deploy to CDN" step, so 10,000 pages/images timed out.
Workaround: Build 3,000 pages at a time. Netlify caching algo makes subsequent deploys fast.
Generating 10,000 pages is quick (20 seconds), but ruins your watch experience elsewhere, like updating the blog.
Workaround: Add src/bookmarks
to .eleventyignore
--watch
specific folders (instead of manually ignoring files)
Presentation available at:
https://www.briangershon.com/presents/eleventy-adventure/