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): scan and register layouts in nested folders #20190

Conversation

Suv4o
Copy link
Contributor

@Suv4o Suv4o commented Apr 11, 2023

fix(nuxt): Nuxt 3 does not respect layouts in separate folders (#14275)

πŸ”— Linked issue

resolves #14275

❓ 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

Fix the issue of not being able to create layouts in different directories, as specified in Issue #14275.

Now, we can define layouts in the following format:

For example:

File Layout name
~/layouts/desktop/default.vue 'desktop-default'
~/layouts/desktop-base/base.vue 'desktop-base'
~/layouts/desktop/index.vue 'desktop'
<template>
    <NuxtLayout name="desktop-base">
      <NuxtPage />
    </NuxtLayout>
</template>

πŸ“ Checklist

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

@codesandbox
Copy link

codesandbox bot commented Apr 11, 2023

CodeSandbox logoCodeSandbox logoΒ  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

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

Wonderful - this looks great! ❀️

Just one change - rather than placing the normalisation logic here in the runtime, can we do it in the build time context (packages/nuxt/src/core/app.ts)?

@danielroe danielroe added this to the v3.5 milestone May 2, 2023
@danielroe danielroe removed this from the v3.5 milestone May 16, 2023
@daktas
Copy link

daktas commented Jun 23, 2023

@pi0 / @danielroe / @Atinux
anybody to validate this usefull PR ?

Copy link
Member

I have already reviewed and requested a change.

@danielroe danielroe added this to the 3.7 milestone Jun 26, 2023
@danielroe danielroe changed the title fix(nuxt): Nuxt 3 does not respect layouts in separate folders (#14275) fix(nuxt): Nuxt 3 does not respect layouts in separate folders Jul 20, 2023
@danielroe danielroe modified the milestones: 3.7, 3.8 Sep 1, 2023
@danielroe danielroe changed the title fix(nuxt): Nuxt 3 does not respect layouts in separate folders feat(nuxt): scan and register layouts in nested folders Oct 16, 2023
@danielroe danielroe added enhancement and removed bug labels Oct 16, 2023
@danielroe danielroe force-pushed the fix/14275-nuxt-3-does-not-respect-layouts-in-separate-folders branch from 224143f to 75990c5 Compare October 16, 2023 10:50
@danielroe danielroe dismissed their stale review October 16, 2023 12:12

now implemented

@Atinux
Copy link
Member

Atinux commented Oct 16, 2023

Looks good to me, would be nice to update the documentation about it (can be done later)

@nuxt-studio
Copy link

nuxt-studio bot commented Oct 16, 2023

βœ… Live Preview ready!

Name Edit Preview Latest Commit
Nuxt Docs Edit on Studio β†—οΈŽ View Live Preview 647ee7e

@danielroe danielroe merged commit 00917a1 into nuxt:main Oct 16, 2023
34 of 35 checks passed
@github-actions github-actions bot mentioned this pull request Oct 16, 2023
@madsh93
Copy link
Sponsor

madsh93 commented Oct 30, 2023

I'm not sure if the is the right place to ask. What is the use case for this feature? Just curious.

manniL pushed a commit that referenced this pull request Dec 11, 2023
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.

Nuxt 3 does not respect layouts in separate folders
5 participants