mirror of https://github.com/YunYouJun/valaxy
41 lines
993 B
TypeScript
41 lines
993 B
TypeScript
import type { ResolvedValaxyOptions } from 'valaxy'
|
|
import { defineTheme } from 'valaxy'
|
|
import type { Plugin } from 'vite'
|
|
import { defaultThemeConfig } from './config'
|
|
import type { ThemeConfig } from './types'
|
|
|
|
function ThemeVitePlugin(_options?: ResolvedValaxyOptions<ThemeConfig>): Plugin {
|
|
// TODO:
|
|
// const themeConfig = options.config.themeConfig!
|
|
|
|
return {
|
|
name: 'valaxy-theme-press',
|
|
enforce: 'pre',
|
|
config() {
|
|
return {
|
|
css: {
|
|
preprocessorOptions: {
|
|
scss: {
|
|
// additionalData: `$c-primary: ${themeConfig.colors?.primary || '#0078E7'} !default;`,
|
|
additionalData: `$c-primary: ${'#0078E7'} !default;`,
|
|
},
|
|
},
|
|
},
|
|
|
|
optimizeDeps: {
|
|
exclude: ['@docsearch/js'],
|
|
},
|
|
}
|
|
},
|
|
}
|
|
}
|
|
|
|
export default defineTheme<ThemeConfig>((_options) => {
|
|
return {
|
|
themeConfig: defaultThemeConfig,
|
|
vite: {
|
|
plugins: [ThemeVitePlugin()],
|
|
},
|
|
}
|
|
})
|