@@ -2,7 +2,7 @@ const path = require('path')
2
2
const createMarkdown = require ( '../markdown/index' )
3
3
const loadConfig = require ( './loadConfig' )
4
4
const loadTheme = require ( './loadTheme' )
5
- const { fs, logger, chalk, globby, sort } = require ( '@vuepress/shared-utils' )
5
+ const { fs, logger, chalk, globby, sort, datatypes : { isFunction } } = require ( '@vuepress/shared-utils' )
6
6
7
7
const Page = require ( './Page' )
8
8
const I18n = require ( './I18n' )
@@ -30,6 +30,10 @@ module.exports = class AppContext {
30
30
31
31
this . vuepressDir = path . resolve ( sourceDir , '.vuepress' )
32
32
this . siteConfig = loadConfig ( this . vuepressDir )
33
+ if ( isFunction ( this . siteConfig ) ) {
34
+ this . siteConfig = this . siteConfig ( this )
35
+ }
36
+
33
37
this . base = this . siteConfig . base || '/'
34
38
this . themeConfig = this . siteConfig . themeConfig || { }
35
39
this . outDir = this . siteConfig . dest
@@ -81,6 +85,7 @@ module.exports = class AppContext {
81
85
82
86
this . pluginAPI
83
87
// internl core plugins
88
+ . use ( Object . assign ( { } , siteConfig , { name : '@vuepress/internal-site-config' } ) )
84
89
. use ( require ( '../internal-plugins/siteData' ) )
85
90
. use ( require ( '../internal-plugins/routes' ) )
86
91
. use ( require ( '../internal-plugins/rootMixins' ) )
0 commit comments