-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
* added new util method to get the name from layout * added deep search on /layouts folder * added test cases for mobile and desktop layouts
✅ Deploy Preview for nuxt3-docs canceled.
|
Thank you ❤️ |
This comment was marked as off-topic.
This comment was marked as off-topic.
What can we do to get this approved pull |
this PR needs a slight change as it has already been implemented as to switch layout I would recommend looking at the link Here for example, maybe you have an audio player on a podcast website that you want to continue playing as users navigate the site. Or, you may want to maintain the scroll position in your navigation between page visits. In these situations, using persistent layouts is a better choice.
|
@Aksoom-Hussain I don't think that is the problem this PR is trying to solve. Currently something like this is not possible, every layout must be in the root of the layouts directory. definePageMeta({
layout: 'theme1/layout1',
}); |
247e18b
to
c98e5c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this PR - I think we do need to support layouts in nested folders, and this was a nice implementation 👌
However, on reflection I think the most consistent/intuitive approach is to follow the pattern of the components directory - producing & deduplicating segments. We can extract the utility and share it between the two parts of Nuxt.
For example:
File | Layout name |
---|---|
~/layouts/desktop/default.vue | 'desktop-default' |
~/layouts/desktop-base/base.vue | 'desktop-base' |
~/layouts/desktop/index.vue | 'desktop' |
If you have time to implement, that would be great! If not, please do let me know 🙏
oh, just saw this. Thankfully 5 days later and not months or a year. |
I am sorry for the delay in having this PR reviewed! Okay, I'll close this PR here and comment on the issue you created so no one else is blocked in adding this feature. |
This PR resolves the issue #5793 A developer will be able to create multiple folders in /layouts and then access them in pages.
This feature was heavily inspired in the PR Adds support for folders in /layouts nuxt/nuxt.js#12765
for Nuxt 2 and works in the exact same way.
For instance, if in /layouts there are 2 folders like:
the developer is able to create files which are named the same but they are in different folders.
Like folder1/default.vue and folder2/default.vue and then access those layouts in /pages using following rule.
folder_in_layouts
+layout-file-name
Pull Request re opened due to a linter over editing the code in feat(nuxt): nested layout files nuxt/framework#5796