nuxt-modules / turnstile

πŸ”₯ Cloudflare Turnstile integration for Nuxt

Home Page:https://cloudflare.com/products/turnstile

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

perf: load script only on pages where it is used

avi-agg opened this issue Β· comments

πŸ“š Is your documentation request related to a problem?

By default the Script is being loaded on all pages. I want it to load on selected pages. How can I do that?,

πŸ” Where should you find it?

No response

ℹ️ Additional context

No response

I think the plugin's functionality to load the script would need to be moved to the NuxtTurnstile component. Before I say "pull request welcome" though, I'd like to ask @danielroe if there is any reason to keep the head extension in the plugin.

Yes, I think it would be nice to move it to the component, if we can implement it so it's deduplicated across components and also not removed from the head if the component is unmounted (as this could result in the script being loaded more than once).

That's great to hear... Can you create a pull request for it?

I think this is a good task for a community PR, help welcome! πŸ™Œ

@danielroe did #306 help to resolve this issue or is this unrelated?

yes, this should be resolved!