mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
a548b70342
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Sébastien Chopin <seb@nuxt.com>
44 lines
1.8 KiB
Markdown
44 lines
1.8 KiB
Markdown
---
|
|
title: 'Layers'
|
|
description: Nuxt provides a powerful system that allows you to extend the default files, configs, and much more.
|
|
navigation.icon: i-ph-stack-duotone
|
|
---
|
|
|
|
One of the core features of Nuxt 3 is the layers and extending support. You can extend a default Nuxt application to reuse components, utils, and configuration. The layers structure is almost identical to a standard Nuxt application which makes them easy to author and maintain.
|
|
|
|
## Use Cases
|
|
|
|
- Share reusable configuration presets across projects using `nuxt.config` and `app.config`
|
|
- Create a component library using [`components/`](/docs/guide/directory-structure/components) directory
|
|
- Create utility and composable library using [`composables/`](/docs/guide/directory-structure/composables) and [`utils/`](/docs/guide/directory-structure/utils) directories
|
|
- Create Nuxt module presets
|
|
- Share standard setup across projects
|
|
- Create [Nuxt themes](https://github.com/nuxt-themes)
|
|
|
|
## Usage
|
|
|
|
You can extend a layer by adding the [extends](/docs/api/nuxt-config#extends) property to the [`nuxt.config.ts`](/docs/guide/directory-structure/nuxt-config) file.
|
|
|
|
```ts [nuxt.config.ts]
|
|
export default defineNuxtConfig({
|
|
extends: [
|
|
'../base', // Extend from a local layer
|
|
'@my-themes/awesome', // Extend from an installed npm package
|
|
'github:my-themes/awesome#v1', // Extend from a git repository
|
|
]
|
|
})
|
|
```
|
|
|
|
::read-more{to="/docs/guide/going-further/layers"}
|
|
Read more about layers in the **Layer Author Guide**.
|
|
::
|
|
|
|
::callout{color="blue" icon="i-ph-video-duotone" to="https://www.youtube.com/watch?v=lnFCM7c9f7I" target="_blank"}
|
|
Watch Learn Vue video about Nuxt Layers.
|
|
::
|
|
|
|
## Examples
|
|
|
|
- [Nuxt Docus Theme](https://github.com/nuxt-themes/docus#readme)
|
|
- [Nuxt Content Wind Theme](https://github.com/Atinux/content-wind#readme)
|