Skip to content

Commit b668875

Browse files
committed
refactor: load theme/enhanceApp.js instead of index.js
1 parent 2f0da01 commit b668875

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

lib/prepare.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,18 @@ if (!Object.assign) Object.assign = require('object-assign')`
6363

6464
// 6. handle enhanceApp.js
6565
const enhanceAppPath = path.resolve(sourceDir, '.vuepress/enhanceApp.js')
66-
writeEnhanceTemp('enhanceApp.js', enhanceAppPath, fs.existsSync(enhanceAppPath))
66+
writeEnhanceTemp(
67+
'enhanceApp.js',
68+
enhanceAppPath,
69+
fs.existsSync(enhanceAppPath)
70+
)
6771

68-
// 7. handle the theme index.js
69-
writeEnhanceTemp('themeEnhanceApp.js', options.themeApp, fs.existsSync(options.themeApp))
72+
// 7. handle the theme enhanceApp.js
73+
writeEnhanceTemp(
74+
'themeEnhanceApp.js',
75+
options.themeEnhanceAppPath,
76+
fs.existsSync(options.themeEnhanceAppPath)
77+
)
7078

7179
return options
7280
}
@@ -167,9 +175,9 @@ async function resolveOptions (sourceDir) {
167175
options.notFoundPath = path.resolve(__dirname, 'default-theme/NotFound.vue')
168176
}
169177

170-
const themeApp = path.resolve(themeDir, 'index.js')
171-
if (fs.existsSync(themeApp)) {
172-
options.themeApp = themeApp
178+
const themeEnhanceAppPath = path.resolve(themeDir, 'index.js')
179+
if (fs.existsSync(themeEnhanceAppPath)) {
180+
options.themeEnhanceAppPath = themeEnhanceAppPath
173181
}
174182
}
175183

0 commit comments

Comments
 (0)