Files
takerofnotes-website/vite.config.js
2026-06-01 11:08:03 -04:00

50 lines
1.6 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)),
},
},
server: {
headers: {
// Allow the app to be embedded in iframes from Strapi admin
'Content-Security-Policy':
"frame-ancestors 'self' https://cms.takerofnotes.com",
},
},
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)
},
},
},
},
},
})