Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

[Feature Request] Add support for HTMLRewriter #138

Closed
Cherry opened this issue Feb 2, 2020 · 6 comments
Closed

[Feature Request] Add support for HTMLRewriter #138

Cherry opened this issue Feb 2, 2020 · 6 comments

Comments

@Cherry
Copy link

Cherry commented Feb 2, 2020

Testing HTMLRewriter locally would be really awesome. Currently, ReferenceError: HTMLRewriter is not defined is just thrown when attempting to use it.

Reference: https://developers.cloudflare.com/workers/reference/apis/html-rewriter/
Cloudflare do publish the source for this too, at https://github.com/cloudflare/lol-html

@bkeroackdsc
Copy link
Contributor

Hi @Cherry! Unfortunately cloudworker is no longer actively maintained at DSC, so this is unlikely to be looked at in the near future. Perhaps we will find a volunteer at some point.

@xtuc
Copy link

xtuc commented Feb 3, 2020

The HTMLRewriter could be integrated using cloudflare/lol-html#38

@grakic
Copy link

grakic commented May 3, 2020

Thanks to @defjosiah I have a bit more complete HTMLRewriter shim: https://gist.github.com/grakic/b25d54f27223154023cfb3042ab66d41

Use locally with webpack.dev.js as:

    plugins: [
        new webpack.ProvidePlugin({
            HTMLRewriter: [__dirname + '/src/mock.js', 'default']
        }),
    ]

There are differences like in how it handles <div>Hello<p>World</p>Extra<br></div> but it is similar enough that it helped me debug a few issues locally.

@defjosiah
Copy link

@grakic that looks great! Thanks for extending it. Will replace our mock with that 😄

@Cherry
Copy link
Author

Cherry commented Dec 7, 2020

I'm going to go ahead and close this. Cloudflare's wrangler dev has taken over all of our dev use-cases and needs.

@Cherry Cherry closed this as completed Dec 7, 2020
@qwtel
Copy link

qwtel commented Mar 22, 2021

In case someone's still looking for a HTMLRewriter polyfill, here is another one: https://github.com/worker-tools/parsed-html-rewriter

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants