Tailwind, Eleventy, Alpine: Towards a lightweight Jamstack

A presentation at Jamstack Berlin Meetup in July 2020 in by Nicolas Goutay

Slide 1

Slide 1

Title

Tailwind, Eleventy, Alpine: Towards a lightweight Jamstack

Slide 2

Slide 2

Bio

Nicolas Goutay Software Developer  Orbit Co-host  Jamstack Paris Twitter: @phacks

Slide 3

Slide 3

From Jekyll to Gatsby

Slide 4

Slide 4

Static (Jekyll)

User: “hey could you pass me that index.html file you got there?” Server: “sure thing there you go” User: “thanks”

Slide 5

Slide 5

Server Rendering (Wordpress)

User: “hey i would like to read the latest comments on that article” Server: “yeah give me a few seconds to look them up” Server computes for a moment… Server: “here they are” User: “thanks”

Slide 6

Slide 6

Client-Side Rendering (Create React App)

User: “oooh this new online publication looks cool can i see it?” Server: “you know what why don’t you take all the raw materials and figure it out yourself” User: “wow rude but ok” User computes for a moment… User: “it works!”

Slide 7

Slide 7

Server-Side Rendering (Next, Nuxt)

User: “i heard they worked on performance on this publication” Server: “they did! here it is: i’m building the page very quicky…” Server computes for a moment… Server: “and now send you the raw materials to build it yourself BUT now you have a nice picture of the finished page to look at meanwhile!”

Slide 8

Slide 8

Server-Side Rendering (Next, Nuxt)

Server: “and now send you the raw materials to build it yourself BUT now you have a nice picture of the finished page to look at meanwhile!” User: “sweet! i can see the content first…” Useer: “and now click around!”

Slide 9

Slide 9

OUTLI NE CSR with Prerendering (Gatsby, Next, Nuxt) FROM JEKYLL TO GATSBY hmm they worked on performance yet again? THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE yeah they figured out that content didn’t change much so now we build only once, when content changes. No more rebuilding on each request! no change for you though, you still get your picture and the raw materials sweet! i can see the content first… and now click around! & /phacks

Slide 10

Slide 10

OUTLI NE FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks The cost of JS frameworks

Slide 11

Slide 11

OUTLI NE The JavaScript Performance Tax FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Source: https://v8.dev/blog/cost-of-javascript-2019

Slide 12

Slide 12

The JavaScript Performance Tax OUTLI NE FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks 📩 The cost of downloading the file on the network 📝 The cost of parsing and compiling the file 🏗 The cost of executing the JavaScript 💭 The memory cost Source: https://timkadlec.com/remembers/20190109-the-ethics-of-performance/

Slide 13

Slide 13

OUTLI NE The JavaScript Performance Tax FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS JavaScript Bytes Served to Mobile Devices, by Percentile CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Source: https://timkadlec.com/remembers/20200421-the-cost-of-javascript-frameworks/

Slide 14

Slide 14

OUTLI NE FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS The JavaScript Performance Tax Scripting related CPU time (in milliseconds) for mobile devices, in percentiles CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Source: https://timkadlec.com/remembers/20200421-the-cost-of-javascript-frameworks/

Slide 15

Slide 15

OUTLI NE FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Curbing the JS tax for existing Jamstack websites

Slide 16

Slide 16

OUTLI NE Removing JavaScript altogether FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Is your JavaScript framework really doing important work on your website?

Slide 17

Slide 17

OUTLI NE FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Removing JavaScript altogether Is your JavaScript framework really doing important work on your website?

Slide 18

Slide 18

OUTLI NE Removing JavaScript altogether FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE Available through a plugin: https://www.gatsbyjs.org/packages/ gatsby-plugin-no-javascript/ Experimental built-in support: https://github.com/vercel/next.js/pull/ 11949 & /phacks

Slide 19

Slide 19

OUTLI NE Switching to Preact FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks “Fast 3kB alternative to React with the same modern API.”

Slide 20

Slide 20

OUTLI NE Switching to Preact FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Source: https://bundlephobia.com

Slide 21

Slide 21

OUTLI NE Switching to Preact FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE Available through a plugin: https://www.gatsbyjs.org/packages/ gatsby-plugin-preact/ Example project: https://github.com/vercel/next.js/tree/ canary/examples/using-preact & /phacks

Slide 22

Slide 22

OUTLI NE FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Building the new Orbit.love with Tailwind, Eleventy & Alpine

Slide 23

Slide 23

OUTLI NE FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks The new orbit.love

Slide 24

Slide 24

OUTLI NE FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Tailwind, Eleventy, Alpine: the TEA stack

Slide 25

Slide 25

OUTLI NE Tailwind, Eleventy, Alpine: the TEA stack FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE Eleventy assumes no JavaScript Framework in the output & /phacks

Slide 26

Slide 26

OUTLI NE Tailwind, Eleventy, Alpine: the TEA stack FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Eleventy assumes no JavaScript Framework in the output

Slide 27

Slide 27

OUTLI NE Tailwind, Eleventy, Alpine: the TEA stack FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE Tailwind feels a bit like CSS-in-JS, without the JS & /phacks

Slide 28

Slide 28

OUTLI NE Tailwind, Eleventy, Alpine: the TEA stack FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Tailwind feels a bit like CSS-in-JS, without the JS

Slide 29

Slide 29

OUTLI NE Tailwind, Eleventy, Alpine: the TEA stack FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Alpine is a lightweight (8 kB library with a Vue-like syntax aimed at sprinkling interactivity on top of HTML

Slide 30

Slide 30

OUTLI NE Tailwind, Eleventy, Alpine: the TEA stack FROM JEKYLL TO GATSBY THE COST OF JS FRAMEWORKS CURBING THE JAVASCRIPT TAX BUILDING THE NEW ORBIT.LOVE: TAILWIND, ELEVENTY & ALPINE & /phacks Alpine is a lightweight (8 kB library with a Vue-like syntax aimed at sprinkling interactivity on top of HTML

Slide 31

Slide 31

Thank you! https://github.com/orbit-love/orbit-web Slides are available on https://noti.st/phacks Fonts used for this presentation: • Faune (headers) by Alice Savoie/CNAP • Overpass (outline) by Delve Fonts • Inter (body copy) by Rasmus Andersson • IBM Plex Mono (monospace) by IBM & /phacks