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

Is layouts/ directory useful? #16

Closed
Glandos opened this issue Jan 27, 2023 · 7 comments
Closed

Is layouts/ directory useful? #16

Glandos opened this issue Jan 27, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@Glandos
Copy link

Glandos commented Jan 27, 2023

I've noticed the creation of layouts/ directories with 2 Vue files, that are referenced in the router configuration.

However, they are not used, since the main.ts loads App.vue that doesn't do anything with either <router-view /> nor those files in layouts/ directory.

@istvank
Copy link

istvank commented Jan 29, 2023

There is not even a <router-view> in your App.vue?
Is it this one? https://github.com/vuetifyjs/create-vuetify/blob/master/template/typescript/default/src/App.vue

Btw., as a newbie to Vuetify I was also a bit confused about the different directories for components, being components, layouts, and views. I couldn't find documentation about them anywhere. Seems like layouts are there for the greater, route-specific layout (cf. layouting system of Vuetify), views are for certain reusable UI patterns that you can use in multiple layouts, and components are for reusable, more fine-grained UI components.

@Glandos
Copy link
Author

Glandos commented Jan 29, 2023

@istvank commented on Jan 29, 2023, 3:19 PM GMT+1:

There is not even a <router-view> in your App.vue?

No, as the template doesn't contain any.

Is it this one? master/template/typescript/default/src/App.vue

Yes.

Btw., as a newbie to Vuetify I was also a bit confused about the different directories for components, being components, layouts, and views. I couldn't find documentation about them anywhere. Seems like layouts are there for the greater, route-specific layout (cf. layouting system of Vuetify), views are for certain reusable UI patterns that you can use in multiple layouts, and components are for reusable, more fine-grained UI components.

Those directories are just a "default" layout, they are not enforced anywhere. You can call them dir1/, dir2/ and tmp/ if you like your code as a mess :)

@johnleider
Copy link
Member

We used to have README.md files for each directory but that seems to be gone for whatever reason.

@johnleider johnleider added the bug Something isn't working label Apr 10, 2023
@yanliang2004
Copy link

With unplugin-vue-router, routes are automatically created for pages in src/pages, without using any layouts.
How are layouts and pages supposed to be used?

@johnleider
Copy link
Member

Layouts are setup using https://github.com/JohnCampionJr/vite-plugin-vue-layouts which is compat with unplugin-vue-router. I believe this issue is outdated since it relates to an old version of the vuetify-create plugin.

@juw177
Copy link

juw177 commented Feb 25, 2024

The latest create vuetify uses vite-plugin-vue-layouts with unplugin-vue-router. All it does in practice is wrap /layouts/default around every page without causing a nested route to be created.

Not worthwhile IMO as it can just go in App.vue without having to deal with extra complexity.

@johnleider
Copy link
Member

The latest create vuetify uses vite-plugin-vue-layouts with unplugin-vue-router. All it does in practice is wrap /layouts/default around every page without causing a nested route to be created.

Not worthwhile IMO as it can just go in App.vue without having to deal with extra complexity.

I agree, this is why we have different presets. Default / Base don't include layouts.

Subsequently, I'm going to close this answer, ty all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants