Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

feat(nuxt3)!: enable using <NuxtLayout> without pages integration #3610

Merged
merged 8 commits into from
Mar 14, 2022

Conversation

danielroe
Copy link
Member

@danielroe danielroe commented Mar 11, 2022

πŸ”— Linked issue

resolves nuxt/nuxt#12829

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 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)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR extracts the Nuxt layouts integration out of the pages module, meaning <NuxtLayout> can be used anywhere in a Nuxt app even if the ~/pages integration isn't.

It also adds support for extends with layouts.

BREAKING CHANGE:

  • we remove the pages:layouts:extend hook

Possible improvements

  • type the layout prop within <NuxtLayout> - this would require a new utility interface exported from #app that we could hook into here and in PageMeta

πŸ‘‰ Migration

  • If you are using pages:layouts:extend hook, then you can switch to using app:resolve, where you will be able to access app.layouts.

πŸ“ Checklist

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

@danielroe danielroe added enhancement New feature or request pages labels Mar 11, 2022
@danielroe danielroe requested a review from pi0 March 11, 2022 14:26
@danielroe danielroe self-assigned this Mar 11, 2022
@netlify
Copy link

netlify bot commented Mar 11, 2022

βœ”οΈ Deploy Preview for nuxt3-docs canceled.

πŸ”¨ Explore the source changes: 549ffef

πŸ” Inspect the deploy log: https://app.netlify.com/sites/nuxt3-docs/deploys/622f1b604d3ea40008ea5317

packages/nuxt3/src/core/utils.ts Outdated Show resolved Hide resolved
```vue
```vue{}[app.vue]
<template>
<NuxtLayout :name="$route.path === '/' ? 'custom' : false">
Copy link
Member

Choose a reason for hiding this comment

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

Maybe split into simple layout usage and a dynamic example for more advanced cases using a computed?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll simplify this. Maybe we can keep the example at the end of the file for the computed.

packages/nuxt3/src/app/composables/utils.ts Outdated Show resolved Hide resolved
packages/nuxt3/src/app/composables/utils.ts Outdated Show resolved Hide resolved
@danielroe danielroe changed the title feat(nuxt3): enable using <NuxtLayout> without pages integration feat(nuxt3)!: enable using <NuxtLayout> without pages integration Mar 12, 2022
@pi0 pi0 merged commit 7bf338d into main Mar 14, 2022
@pi0 pi0 deleted the feat/free-nuxt-layout branch March 14, 2022 10:47
@danielroe danielroe added the 3.x label Jan 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3.x enhancement New feature or request pages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Moving <NuxtLayout> to a built-in component
2 participants