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