Files
takerofnotes-website/vite.config.js
2026-05-18 15:13:23 -04:00

43 lines
1.3 KiB
JavaScript

import { fileURLToPath, URL } from 'node:url'
import vue from '@vitejs/plugin-vue'
import vike from 'vike/plugin'
import { defineConfig } from 'vite'
import { toSass } from './libs/sass-utils'
import theme from './libs/theme'
export default defineConfig({
plugins: [vike(), vue()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./', import.meta.url)),
},
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
additionalData:
'@use "/styles/_functions.scss" as *; @use "/styles/_font-style.scss" as *;',
functions: {
'get($keys)': function (keys) {
keys = keys.toString().replace(/['"]+/g, '').split('.')
let result = theme
for (let i = 0; i < keys.length; i++) {
result = result[keys[i]]
}
return toSass(result)
},
'getColors()': function () {
return toSass(theme.colors)
},
'getThemes()': function () {
return toSass(theme.themes)
},
},
},
},
},
})