diff --git a/packages/@vuepress/core/__tests__/prepare/fixtures/docs-config/.vuepress/config.js b/packages/@vuepress/core/__tests__/prepare/fixtures/docs-config/.vuepress/config.js index 665e1164b3..f4019472e5 100644 --- a/packages/@vuepress/core/__tests__/prepare/fixtures/docs-config/.vuepress/config.js +++ b/packages/@vuepress/core/__tests__/prepare/fixtures/docs-config/.vuepress/config.js @@ -1,6 +1,4 @@ module.exports = { - title: 'Hello VuePress', - description: '# Hello, VuePress!', dest: 'vuepress', base: 'vuepress', head: [ diff --git a/packages/@vuepress/core/__tests__/prepare/fixtures/docs-config/.vuepress/config.yml b/packages/@vuepress/core/__tests__/prepare/fixtures/docs-config/.vuepress/config.yml new file mode 100644 index 0000000000..d84b90de9e --- /dev/null +++ b/packages/@vuepress/core/__tests__/prepare/fixtures/docs-config/.vuepress/config.yml @@ -0,0 +1,3 @@ +--- +title: Hello VuePress +description: '# Hello, VuePress!' diff --git a/packages/@vuepress/core/lib/prepare/loadConfig.js b/packages/@vuepress/core/lib/prepare/loadConfig.js index c786e88d44..ad4cd45f79 100644 --- a/packages/@vuepress/core/lib/prepare/loadConfig.js +++ b/packages/@vuepress/core/lib/prepare/loadConfig.js @@ -24,11 +24,13 @@ module.exports = function loadConfig (vuepressDir, bustCache = true) { // resolve siteConfig let siteConfig = {} if (fs.existsSync(configYmlPath)) { - siteConfig = parseConfig(configYmlPath) - } else if (fs.existsSync(configTomlPath)) { - siteConfig = parseConfig(configTomlPath) - } else if (fs.existsSync(configPath)) { - siteConfig = require(configPath) + siteConfig = Object.assign(siteConfig, parseConfig(configYmlPath)) + } + if (fs.existsSync(configTomlPath)) { + siteConfig = Object.assign(siteConfig, parseConfig(configTomlPath)) + } + if (fs.existsSync(configPath)) { + siteConfig = Object.assign(siteConfig, require(configPath)) } return siteConfig diff --git a/packages/docs/docs/.vuepress/config.js b/packages/docs/docs/.vuepress/config.js index b56d1334ed..a3d5d281ec 100755 --- a/packages/docs/docs/.vuepress/config.js +++ b/packages/docs/docs/.vuepress/config.js @@ -1,6 +1,6 @@ const container = require('markdown-it-container') -module.exports = ctx => ({ +module.exports = { dest: '../../vuepress', locales: { '/': { @@ -63,7 +63,7 @@ module.exports = ctx => ({ } }, plugins: [ - ['@vuepress/i18n-ui', !ctx.isProd], + ['@vuepress/i18n-ui'], ['@vuepress/back-to-top', true], ['@vuepress/pwa', { serviceWorker: true, @@ -82,7 +82,7 @@ module.exports = ctx => ({ : '' }) }, -}) +} function getGuideSidebar (groupA, groupB) { return [ diff --git a/packages/docs/docs/guide/basic-config.md b/packages/docs/docs/guide/basic-config.md index 5a17dbcd01..7ba7cfb13e 100644 --- a/packages/docs/docs/guide/basic-config.md +++ b/packages/docs/docs/guide/basic-config.md @@ -27,7 +27,7 @@ If you've got the dev server running, you should see the page now has a header w Consult the [Config Reference](../config/README.md) for a full list of options. ::: tip Alternative Config Formats -You can also use YAML (`.vuepress/config.yml`) or TOML (`.vuepress/config.toml`) formats for the configuration file. +You can also split config and use YAML (`.vuepress/config.yml`) or TOML (`.vuepress/config.toml`) formats for the configuration. All configuration files will be merged together. ::: ## Theme Configuration