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

feat(nuxt): allow configuring default <NuxtLink> options #23724

Merged
merged 3 commits into from Oct 18, 2023

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Oct 17, 2023

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR allows configuring NuxtLink defaults, such as trailing slash behaviour and default classes/prefetch behaviour. All of these are serialisable and initially can be set in experimental.defaults.nuxtLink but we will likely want to move to appConfig or app/ directory later on.

Example:

export default defineNuxtConfig({
  experimental: {
    defaults: {
      nuxtLink: {
        activeClass: 'nuxt-link-active',
        trailingSlash: 'append'
      }
    }
  }
})

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@stackblitz
Copy link

stackblitz bot commented Oct 17, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@danielroe
Copy link
Member Author

danielroe commented Oct 17, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@danielroe danielroe changed the title feat/nuxt-link-defaults feat(nuxt): allow configuring default <NuxtLink> options Oct 17, 2023
@danielroe danielroe requested a review from lihbr October 17, 2023 15:09
@danielroe danielroe self-assigned this Oct 17, 2023
@danielroe danielroe requested a review from Atinux October 17, 2023 15:12
@danielroe danielroe marked this pull request as ready for review October 17, 2023 15:12
Copy link
Member

@lihbr lihbr left a comment

Choose a reason for hiding this comment

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

LGTM, I had concerns about default serialization behavior if users provided null/undefined/false to experimental.defaults.nuxtLink but defu + TypeScript should prevent that πŸ‘Œ

@danielroe danielroe merged commit 9dd3046 into main Oct 18, 2023
33 checks passed
@danielroe danielroe deleted the 10-17-feat/nuxt-link-defaults branch October 18, 2023 12:43
@github-actions github-actions bot mentioned this pull request Oct 18, 2023
@manniL
Copy link
Member

manniL commented Oct 18, 2023

I had concerns about default serialization behavior

Came to my mind too but I also think that should be fine πŸ‘

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

Successfully merging this pull request may close these issues.

None yet

3 participants