Skip to content

eduardoboucas/frameworkless-ppr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Partial Prerendering Without a Framework

This is a tiny demo of Partial Prerendering with plain HTML, Netlify Functions and Edge Functions without any framework.

Deploy to Netlify

This in implemented by a small edge function ppr.ts that uses the HTMLRewriter library to first let Netlify serve the normal HTML page, while triggering requests for dynamic content during the response stream and appending them at the end of the response with script tags that will insert them at the right location in the document.

You can use the technique by adding tags with a data-ppr attribute:

The time is: <span data-ppr="/partial/time">Loading...<span>

The content of the data-ppr span will get replaced with the response from /partial/time.

Installing

To test locally, clone this repository and run:

npm i
npm install -g netlify-cli
netlify dev

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published