4
4
[ ![ npm downloads] [ npm-d-src ]] [ npm-d-href ]
5
5
[ ![ ci] [ ci-src ]] [ ci-href ]
6
6
7
- Add config extending support to Nuxt 2 projects!
7
+ This utility allows extending a nuxt project based on another one by smartly merging ` nuxt.config ` files.
8
8
9
- ## Features
9
+ It can be useful if:
10
+ - You want to share a base config across mono-repo projects
11
+ - You want to create a multi-variant (like ` mobile ` /` desktop ` ) app
12
+ - You want to create a reusable nuxt theme (like one for docs)
10
13
11
- - Support nested ` extends `
12
- - Smartly merge config and hooks
13
- - Allow theme development to be like a normal nuxt project
14
+ ** Note:** Proper Multi-App ([ rfc] ( https://github.com/nuxt/rfcs/issues/30 ) ) is comming with nuxt3 which also
15
+ allows extending auto scanned directories like ` pages/ ` and ` store/ ` and merging them.
14
16
15
- ## Usage
17
+ ## Mobile/Desktop Demo
18
+
19
+ See [ this example] ( ./example )
16
20
17
- ### Common Setup
21
+ ## Usage
18
22
19
23
Install ` nuxt-extend ` as a dependency:
20
24
@@ -29,10 +33,10 @@ npm i nuxt-extend
29
33
Update ` nuxt.config ` file:
30
34
31
35
``` js
32
- import { resolveConfig } from ' nuxt-extend'
36
+ import { nuxtConfig } from ' nuxt-extend'
33
37
34
- export default resolveConfig ({
35
- // Your actual Nuxt configuration
38
+ export default nuxtConfig ({
39
+ /* your actual nuxt configuration */
36
40
})
37
41
```
38
42
@@ -41,29 +45,29 @@ export default resolveConfig({
41
45
Use ` extends ` key in ` nuxt.config ` :
42
46
43
47
``` js
44
- import { resolveConfig } from ' nuxt-extend'
48
+ import { nuxtConfig } from ' nuxt-extend'
45
49
46
- export default resolveConfig ({
47
- extends: ' @nuxt/docs-theme ' ,
50
+ export default nuxtConfig ({
51
+ extends: ' <path to base or npm package> ' ,
48
52
})
49
53
```
50
54
51
- ### Child
55
+ ### Base
52
56
53
- 1 . Update ` nuxt.config ` and ensure required ` rootDir ` and ` name ` properties are provided
57
+ - Update ` nuxt.config ` and ensure required ` rootDir ` and ` name ` properties are provided
54
58
55
59
``` js
56
- import { resolveConfig } from ' nuxt-extend'
60
+ import { nuxtConfig } from ' nuxt-extend'
57
61
58
- export default resolveConfig ({
62
+ export default nuxtConfig ({
59
63
rootDir: __dirname ,
60
64
name: ' myTheme' ,
61
65
}
62
66
` ` `
63
67
64
- **Note:** If you are extending another theme , ` rootDir` should be ONLY provided if you want to also extend project .
68
+ **Note:** If you are extending recusively , ` rootDir` should be ONLY provided one one level that implements actual ` pages / ` and ` store / ` .
65
69
66
- 2. Instead of using ` ~ / ` or `@/ ` aliases, use ` ~ myTheme` or ` @myTheme`
70
+ - Instead of using ` ~ / ` or `@/ ` aliases, use ` ~ myTheme` or ` @myTheme`
67
71
68
72
## License
69
73
0 commit comments