Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(perf): use HTMLRewriter instead of regex for html transformation #48

Merged
merged 3 commits into from
Aug 25, 2023

Conversation

jasonbarry
Copy link

@jasonbarry jasonbarry commented Aug 24, 2023

This PR uses WASM-based https://workers.tools/html-rewriter/ instead of a regular expression to perform the HTML body transformation, which simplifies code and should give a minor perf boost. Closes #45

Tested on https://deploy-preview-18839--app.netlify.com, as well as https://deploy-preview-48--csp-nonce.netlify.app!

@netlify
Copy link

netlify bot commented Aug 24, 2023

Deploy Preview for csp-nonce ready!

Name Link
🔨 Latest commit 85f3db7
🔍 Latest deploy log https://app.netlify.com/sites/csp-nonce/deploys/64e7d36c15af2e0008da1b4d
😎 Deploy Preview https://deploy-preview-48--csp-nonce.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@ascorbic ascorbic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@jasonbarry jasonbarry merged commit c48daad into main Aug 25, 2023
5 checks passed
@jasonbarry jasonbarry deleted the fix/html-rewriter branch August 25, 2023 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use html-rewriter instead of regex to add nonce attribute to <script> tags
2 participants