braindrops.nicwands.com/drops/testing/vite.config.js
2026-07-17 11:24:36 -04:00

50 lines
1.6 KiB
JavaScript

import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import config from '../../shared/config.js'
import { toSass } from '../../shared/libs/sass/index.js'
export default defineConfig({
plugins: [vue()],
server: {
port: 3000,
},
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@shared': fileURLToPath(new URL('../../shared', import.meta.url)),
},
},
base: '/drops/testing/',
build: {
outDir: '../../app/public/drops/testing',
emptyOutDir: true,
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
additionalData:
'@use "@shared/styles/_functions.scss" as *; @use "@shared/styles/_font-style.scss" as *;',
functions: {
'get($keys)': function (keys) {
keys = keys.toString().replace(/['"]+/g, '').split('.')
let result = config
for (let i = 0; i < keys.length; i++) {
result = result[keys[i]]
}
return toSass(result)
},
'getColors()': function () {
return toSass(config.colors)
},
'getThemes()': function () {
return toSass(config.themes)
},
},
},
},
},
})