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) }, }, }, }, }, })