-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
feat(nuxt): prompt to install nuxt/scripts
on usage
#27010
Conversation
Run & review this pull request in StackBlitz Codeflow. |
Nice, this looks really good. The only thing to consider is the stubs for registry scripts. Adding all of them is too much maintenance effort and bloat but maybe it's worth supporting Not too sure about components stubs, it would be for YoutubeEmbed and GoogleMaps. |
One thought: what do you think about |
v0.3.0 exports /registry which includes all of the Registry Scripts. The resolve may or may not work 🤔 It's also a little heavy as it's shipping the icons used for the DevTools and the docs, will trim it down if you're going to use it. Unrelated to that, as part of this PR I wonder if you'd consider adding support for "stubbing" via Nuxt Config. I imagine a common way for people to use Nuxt Scripts between sites will just be to copy + paste config over. For example my personal sites all use Fathom, I don't use any of the functions provided by Fathom itself so registering the script via nuxt config makes the most sense, I just need to provide the site config. This is similar to Nuxt sites using Plausible. The config would look like export default defineNuxtConfig({
scripts: {
registry: {
fathomAnalytics: {
site: 'SITE_ID'
}
}
}
}) |
I reckon if we have the nuxt config stub we can skip the registry script composables. |
… exists in config
🔗 Linked issue
📚 Description
In preparation for
nuxt/scripts
initial release, this adds a prompt when adding ascripts: {}
option to Nuxt config or using one of:useConsentScriptTrigger
useAnalyticsPageEvent
useElementScriptTrigger
useScript
useScriptGoogleAnalytics
useScriptPlausibleAnalytics
useScriptCloudflareWebAnalytics
useScriptFathomAnalytics
useScriptMatomoAnalytics
useScriptGoogleTagManager
useScriptSegment
useScriptFacebookPixel
useScriptXPixel
useScriptIntercom
useScriptHotjar
useScriptStripe
useScriptLemonSqueezy
useScriptVimeoPlayer
useScriptYouTubeIframe
useScriptGoogleMaps
useScriptNpm
(We also need to add stub docs in #26854 for these, pointing to the source.)
cc: @harlan-zw - do these utilities look like the ones we should stub, or do you think there are any others to include here?