123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- const path = require('path')
- // Theme API.
- module.exports = (options, ctx) => {
- const { themeConfig, siteConfig } = ctx
- // resolve algolia
- const isAlgoliaSearch = (
- themeConfig.algolia
- || Object
- .keys(siteConfig.locales && themeConfig.locales || {})
- .some(base => themeConfig.locales[base].algolia)
- )
- const enableSmoothScroll = themeConfig.smoothScroll === true
- return {
- alias () {
- return {
- '@AlgoliaSearchBox': isAlgoliaSearch
- ? path.resolve(__dirname, 'components/AlgoliaSearchBox.vue')
- : path.resolve(__dirname, 'noopModule.js')
- }
- },
- plugins: [
- ['@vuepress/active-header-links', options.activeHeaderLinks],
- '@vuepress/search',
- '@vuepress/plugin-nprogress',
- ['container', {
- type: 'tip',
- defaultTitle: {
- '/': 'TIP',
- '/zh/': '提示'
- }
- }],
- ['container', {
- type: 'warning',
- defaultTitle: {
- '/': 'WARNING',
- '/zh/': '注意'
- }
- }],
- ['container', {
- type: 'danger',
- defaultTitle: {
- '/': 'WARNING',
- '/zh/': '警告'
- }
- }],
- ['smooth-scroll', enableSmoothScroll]
- ]
- }
- }
|