2023-03-03 16:46:05 +01:00
|
|
|
import { defineConfig } from "vite";
|
|
|
|
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
|
|
|
|
|
|
|
|
import purgecss from "@fullhuman/postcss-purgecss";
|
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
|
|
|
|
|
if (command === "build") {
|
|
|
|
|
return {
|
|
|
|
|
plugins: [svelte()],
|
|
|
|
|
css: {
|
|
|
|
|
postcss: {
|
|
|
|
|
plugins: [
|
|
|
|
|
purgecss({
|
|
|
|
|
content: ["./**/*.html", "./**/*.svelte"],
|
2023-03-06 09:23:06 +01:00
|
|
|
safelist: ["pre", "code"],
|
2023-03-03 16:56:19 +01:00
|
|
|
}),
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
} else {
|
|
|
|
|
return {
|
|
|
|
|
plugins: [svelte()],
|
|
|
|
|
};
|
|
|
|
|
}
|
2023-03-03 16:46:05 +01:00
|
|
|
});
|