2023-03-21 08:53:32 +01:00
|
|
|
import { defineConfig } from 'vite'
|
2023-03-20 13:42:47 +01:00
|
|
|
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
2023-03-23 12:59:02 +01:00
|
|
|
import dsv from '@rollup/plugin-dsv'
|
2023-03-03 16:46:05 +01:00
|
|
|
|
2023-03-20 13:42:47 +01:00
|
|
|
import purgecss from '@fullhuman/postcss-purgecss'
|
2023-03-02 22:12:55 +04:00
|
|
|
|
2023-03-23 12:59:02 +01:00
|
|
|
const plugins = [svelte(), dsv()]
|
|
|
|
|
|
2023-03-02 22:12:55 +04:00
|
|
|
// https://vitejs.dev/config/
|
2023-03-03 16:56:19 +01:00
|
|
|
export default defineConfig(({ command, mode, ssrBuild }) => {
|
|
|
|
|
// Only run PurgeCSS in production builds
|
2023-03-20 13:42:47 +01:00
|
|
|
if (command === 'build') {
|
2023-03-03 16:56:19 +01:00
|
|
|
return {
|
2023-03-23 12:59:02 +01:00
|
|
|
plugins,
|
2023-03-03 16:56:19 +01:00
|
|
|
css: {
|
|
|
|
|
postcss: {
|
|
|
|
|
plugins: [
|
|
|
|
|
purgecss({
|
2023-03-20 13:42:47 +01:00
|
|
|
content: ['./**/*.html', './**/*.svelte'],
|
|
|
|
|
safelist: ['pre', 'code']
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-03-03 16:56:19 +01:00
|
|
|
} else {
|
|
|
|
|
return {
|
2023-03-23 12:59:02 +01:00
|
|
|
plugins
|
2023-03-20 13:42:47 +01:00
|
|
|
}
|
2023-03-03 16:56:19 +01:00
|
|
|
}
|
2023-03-20 13:42:47 +01:00
|
|
|
})
|