2019-04-15 10:35:40 +08:00
|
|
|
const path = require('path')
|
|
|
|
|
|
|
|
// Theme API.
|
|
|
|
module.exports = (options, ctx) => ({
|
|
|
|
alias () {
|
|
|
|
const { themeConfig, siteConfig } = ctx
|
|
|
|
// resolve algolia
|
|
|
|
const isAlgoliaSearch = (
|
|
|
|
themeConfig.algolia
|
|
|
|
|| Object.keys(siteConfig.locales && themeConfig.locales || {})
|
|
|
|
.some(base => themeConfig.locales[base].algolia)
|
|
|
|
)
|
|
|
|
return {
|
|
|
|
'@AlgoliaSearchBox': isAlgoliaSearch
|
|
|
|
? path.resolve(__dirname, 'components/AlgoliaSearchBox.vue')
|
|
|
|
: path.resolve(__dirname, 'noopModule.js')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
'@vuepress/active-header-links',
|
2019-06-25 11:31:44 +08:00
|
|
|
['@vuepress/plugin-blog', {
|
|
|
|
permalink: '/:regular'
|
|
|
|
}],
|
2019-04-15 10:35:40 +08:00
|
|
|
'@vuepress/search',
|
|
|
|
'@vuepress/plugin-nprogress',
|
|
|
|
['container', {
|
|
|
|
type: 'tip',
|
|
|
|
defaultTitle: {
|
|
|
|
'/zh/': '提示'
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
['container', {
|
|
|
|
type: 'warning',
|
|
|
|
defaultTitle: {
|
|
|
|
'/zh/': '注意'
|
|
|
|
}
|
|
|
|
}],
|
|
|
|
['container', {
|
|
|
|
type: 'danger',
|
|
|
|
defaultTitle: {
|
|
|
|
'/zh/': '警告'
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
]
|
|
|
|
})
|