Asynchronous HTMLRewriter for Cloudflare Workers
Cloudflare has introduced support for asynchronous handlers in HTMLRewriter, which enables developers to perform tasks based on the content of an HTML document. This includes prefetching fonts and image assets or fetching user-specific content from a CMS. The new feature allows dynamic HTML injection based on the contents of the document without prior knowledge of what it contains. Developers can now customize HTML based on a particular user, feature flag, or even an integration with a CMS. Examples of projects using HTMLRewriter include elegant web scrapers, image optimization with lazy loading, localizing websites, extending Ghost blogs, and prefetching Google fonts.
Company
Cloudflare
Date published
Aug. 28, 2020
Author(s)
Ashcon Partovi
Word count
642
Hacker News points
2
Language
English