@nuxt/docs-nightly 4.1.0-29263117.a6dec5bd → 4.1.0-29263308.27a80da5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -178,8 +178,8 @@ const date = useLocaleDate(new Date('2016-10-26'))
|
|
|
178
178
|
<p>{{ date }}</p>
|
|
179
179
|
<label for="locale-chooser">Preview a different locale</label>
|
|
180
180
|
<select id="locale-chooser" v-model="locale">
|
|
181
|
-
<option v-for="
|
|
182
|
-
{{
|
|
181
|
+
<option v-for="loc of locales" :key="loc" :value="loc">
|
|
182
|
+
{{ loc }}
|
|
183
183
|
</option>
|
|
184
184
|
</select>
|
|
185
185
|
</div>
|
|
@@ -75,6 +75,27 @@ export default defineNuxtConfig({
|
|
|
75
75
|
|
|
76
76
|
Nuxt uses [unjs/c12](https://c12.unjs.io) and [unjs/giget](https://giget.unjs.io) for extending remote layers. Check the documentation for more information and all available options.
|
|
77
77
|
|
|
78
|
+
## Layer Priority
|
|
79
|
+
|
|
80
|
+
When using multiple layers, it's important to understand how they override each other:
|
|
81
|
+
|
|
82
|
+
1. **Layers in `extends`** - earlier entries have higher priority (first overrides second)
|
|
83
|
+
2. **Auto-scanned local layers** from `~~/layers` directory in alphabetical order (Z overrides A)
|
|
84
|
+
3. **Your project** has the highest priority in the stack - it will always override other layers
|
|
85
|
+
|
|
86
|
+
```ts [nuxt.config.ts]
|
|
87
|
+
export default defineNuxtConfig({
|
|
88
|
+
extends: [
|
|
89
|
+
'../base', // Highest priority (among extends)
|
|
90
|
+
'@my-themes/awesome', // Medium priority
|
|
91
|
+
'github:my-themes/awesome#v1', // Lower priority
|
|
92
|
+
]
|
|
93
|
+
// Your project has the highest priority
|
|
94
|
+
})
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
This means if multiple layers define the same component, configuration, or file, the one with higher priority will be used.
|
|
98
|
+
|
|
78
99
|
::read-more{to="/docs/guide/going-further/layers"}
|
|
79
100
|
Read more about layers in the **Layer Author Guide**.
|
|
80
101
|
::
|
|
@@ -66,6 +66,29 @@ Additionally, certain other files in the layer directory will be auto-scanned an
|
|
|
66
66
|
|
|
67
67
|
::
|
|
68
68
|
|
|
69
|
+
## Layer Priority
|
|
70
|
+
|
|
71
|
+
When extending from multiple layers, it's important to understand the priority order:
|
|
72
|
+
|
|
73
|
+
1. **Layers in `extends`** - earlier entries have higher priority (first overrides second)
|
|
74
|
+
2. **Auto-scanned local layers** from `~~/layers` directory in alphabetical order (Z overrides A)
|
|
75
|
+
3. **Your project** has the highest priority in the stack - it will always override other layers
|
|
76
|
+
|
|
77
|
+
For example:
|
|
78
|
+
|
|
79
|
+
```ts [nuxt.config.ts]
|
|
80
|
+
export default defineNuxtConfig({
|
|
81
|
+
extends: [
|
|
82
|
+
'./layers/base', // Highest priority (among extends)
|
|
83
|
+
'./layers/theme', // Medium priority
|
|
84
|
+
'./layers/custom' // Lower priority
|
|
85
|
+
]
|
|
86
|
+
// Your project has the highest priority
|
|
87
|
+
})
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
If you also have auto-scanned layers like `~~/layers/a` and `~~/layers/z`, the complete override order would be: `base` > `theme` > `custom` > `z` > `a` > your project.
|
|
91
|
+
|
|
69
92
|
## Starter Template
|
|
70
93
|
|
|
71
94
|
To get started you can initialize a layer with the [nuxt/starter/layer template](https://github.com/nuxt/starter/tree/layer). This will create a basic structure you can build upon. Execute this command within the terminal to get started:
|