Better extends (layers) #20380
localusercamp
started this conversation in
Ideas
Replies: 1 comment
-
Agree with modules being able to define or modify layers. I submitted that as an idea here with some background and initial discoveries. I like the expose idea too; saves having to manually configure. I think having a config file per layer is fine. FWIW I use a helper called import { defineLayerConfig } from '../base/utils/nuxt'
export default defineLayerConfig('home', {
prerender: true,
components: true,
content: {
prefix: false
},
}) Regarding your auto-layers idea, there's nothing to stop you writing a small helper to glob said layers, and build the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think that layers is awesome feature and could have more use-cases and options then just extending from another projects.
extends
could be used not only for extending another projects or themes but for composing your own project. In the root folder of nuxt app you could createlayers
directory. Then you could createlayers/auth
andlayers/posts
directories which contains pages, components and so on. This would be very helpful for implementing modular architecture. Here a few ideas of how it could be done:nuxt.config.*
in every layer. For now every layer will contain config file withdefineNuxtConfig({})
.extends
behaviour.extends
config option as all other options throughnuxt.options.extends
;layer
config option in which all nuxt app folders might be specified. This might be helpful to restrict what exactly will be inherited from your project. For now every composable and page will be inherited throughextends
which might be unwanted behaviour in some cases.scoped
. Scoped layers expose only what was specified inlayer.expose
. It means that all auto-imports and components which was used in layer will not be availalbe to "extenders". This will allow to aviod name collisions and restrict unwanted layer usage from another layers.I think if any of above will be implemented it would be a great step further into more customizable nuxt application templates.
This features combined with modules could form a great application templates for different architectures such as DDD and modular architecture.
I'll be glad to discuss this. 👌
Beta Was this translation helpful? Give feedback.
All reactions