
Introducing the HTMLRewriter API Beta to Cloudflare Workers - yarapavan
https://blog.cloudflare.com/html-rewriter-beta/
======
CherryJimbo
This is seriously cool. From Twitter
([https://twitter.com/KentonVarda/status/1178723944007733251](https://twitter.com/KentonVarda/status/1178723944007733251)):

> Not only does this use (much) less overall CPU and RAM, but it avoids
> delaying TTFB. Also elements you want to modify are selected using CSS
> selector syntax which makes things nice and easy. It may seem like a small
> thing to some but I'm pretty excited about this.

Previously I was doing things like fetching content, running some regex
replaces, and then returning the changed content. Being able to do this
dynamically and in real-time without delaying TTFB is incredible.

------
adamschwartz
Check out [https://web.scraper.workers.dev](https://web.scraper.workers.dev)
for an example of HTMLRewriter in action! Here’s the gist of it:
[https://git.io/Jen4K](https://git.io/Jen4K).

