Skip to content
New issue

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

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

Already on GitHub? # to your account

update(doc): recommend useScript for Nuxt 3.11+ #403

Merged
merged 10 commits into from
Apr 8, 2024
Merged

Conversation

vejja
Copy link
Collaborator

@vejja vejja commented Mar 22, 2024

Modify notes to recommend useScript

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

For Nuxt version 3.11 and above, useScript allows to insert any external script in a CSP-compatible way.
Update documentation to recommend useScript.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes (if not applicable, please state why)

Modify notes to recommend `useScript`
Copy link

vercel bot commented Mar 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nuxt-security ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 8, 2024 5:51am

@vejja vejja marked this pull request as draft March 22, 2024 10:15
@vejja vejja changed the title Update 1.csp.md update(doc): recommend useScript for Nuxt 3.11+ Mar 22, 2024
@vejja vejja self-assigned this Mar 22, 2024
@vejja vejja marked this pull request as ready for review March 22, 2024 15:16
@vejja vejja requested a review from Baroshem March 22, 2024 15:16
@vejja
Copy link
Collaborator Author

vejja commented Mar 22, 2024

@Baroshem I'm thinking maybe I should remove all references to useHead and push them back at the end of the document, because now the text is very long and it doesn't help with clarity
What's your opinion ?

@Baroshem
Copy link
Owner

Hey @vejja .

Thanks for this note! It is much cleaner now!

Regardinng getting rid of useHead. Yes please do so! Lets keep one format that we want to recommend users to follow. UseScript should be recommended approach from now on :)

@vejja
Copy link
Collaborator Author

vejja commented Mar 26, 2024

@Baroshem please don't merge this yet, I'm reverting to draft
Reason is, @harlan-zw released the stable version of useScript yesterday, so I want to update usage notes first

@vejja vejja marked this pull request as draft March 26, 2024 08:57
@harlan-zw
Copy link

Hi @vejja, I've sent you access to Nuxt Scripts, maybe it will help with this PR.

@vejja
Copy link
Collaborator Author

vejja commented Mar 27, 2024

Hi @vejja, I've sent you access to Nuxt Scripts, maybe it will help with this PR.

Indeed, thanks !

@Baroshem
Copy link
Owner

Hey @vejja

Should this pull request be still draft? Not sure what is the actual state of it :)

Also, could you contact me in any channels like Discord, X, Linkedin? I would love to get more contact with you so that we could discuss certain things more easily :)

@vejja
Copy link
Collaborator Author

vejja commented Mar 29, 2024

Hey @vejja

Should this pull request be still draft? Not sure what is the actual state of it :)

Also, could you contact me in any channels like Discord, X, Linkedin? I would love to get more contact with you so that we could discuss certain things more easily :)

Yes it is still draft, I need to update for idle status removal
Will contact you separately

`idle` option removed in `useScript` v 1.9.4
client mode is now the default
Update for removal of `idle`option
Client-side loading is the default since `useScript` v 1.9.4
Also simplifies this section by removing old sections about `useHead`
@vejja
Copy link
Collaborator Author

vejja commented Apr 2, 2024

@Baroshem
The docs are now updated for useScript v1.9.4 (released yesterday) which is even simpler because we can skip using trigger 🚀
But I'm still keeping this as draft because Nuxt 3.11.1 still pins unhead to v1.8.20 (which has the old syntax). I will mark it as ready in the next release of Nuxt.

comes with useScript 1.9.4
@vejja vejja marked this pull request as ready for review April 4, 2024 17:32
Required to ensure test pass with Nuxt 3.11.2
@vejja
Copy link
Collaborator Author

vejja commented Apr 4, 2024

@Baroshem this is good to go !
Nuxt 3.11.2 now includes unhead 1.9.4 with its wonderful useScript magic 🚀

Many many thanks to @harlan-zw for ensuring useScript is CSP-compatible, mostly

  • replacing inline event handlers with addEventListener bindings
  • ensuring strict-dynamic works even with SSG by making it client-first by default
    🙏🏻

@Baroshem
Copy link
Owner

Baroshem commented Apr 7, 2024

Awesome @vejja 💚

Thanks for this great write up! I will merge it and publish quite soon!

@Baroshem Baroshem merged commit f765311 into main Apr 8, 2024
5 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants