Skip to content

Commit

Permalink
fix: always define theme globals
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 1, 2021
1 parent 9a17ddf commit 8769b4b
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/node/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path'
import { Plugin } from 'vite'
import { SiteConfig, resolveSiteData } from './config'
import { createMarkdownToVueRenderFn } from './markdownToVue'
import { APP_PATH, DEFAULT_THEME_PATH, SITE_DATA_REQUEST_PATH } from './alias'
import { APP_PATH, SITE_DATA_REQUEST_PATH } from './alias'
import createVuePlugin from '@vitejs/plugin-vue'
import slash from 'slash'
import { OutputAsset, OutputChunk } from 'rollup'
Expand Down Expand Up @@ -37,22 +37,18 @@ export function createVitePressPlugin(

let siteData = site

const isUsingDefaultTheme = themeDir === DEFAULT_THEME_PATH

const vitePressPlugin: Plugin = {
name: 'vitepress',

config() {
return {
alias: aliases,
transformInclude: /\.md$/,
define: isUsingDefaultTheme
? {
__CARBON__: !!site.themeConfig.carbonAds?.carbon,
__BSA__: !!site.themeConfig.carbonAds?.custom,
__ALGOLIA__: !!site.themeConfig.algolia
}
: {}
define: {
__CARBON__: !!site.themeConfig.carbonAds?.carbon,
__BSA__: !!site.themeConfig.carbonAds?.custom,
__ALGOLIA__: !!site.themeConfig.algolia
}
}
},

Expand Down

0 comments on commit 8769b4b

Please sign in to comment.