2024-12-02 03:14:16 +00:00
|
|
|
import { sveltekit } from "@sveltejs/kit/vite";
|
|
|
|
|
import { defineConfig } from "vite";
|
|
|
|
|
import { enhancedImages } from "@sveltejs/enhanced-img";
|
|
|
|
|
import { imagetools } from "@zerodevx/svelte-img/vite";
|
2023-01-22 00:13:42 +00:00
|
|
|
|
2024-12-02 03:14:16 +00:00
|
|
|
export default defineConfig({
|
2023-04-09 20:44:45 +00:00
|
|
|
plugins: [
|
2024-12-02 03:14:16 +00:00
|
|
|
enhancedImages(),
|
2023-04-09 20:44:45 +00:00
|
|
|
sveltekit(),
|
|
|
|
|
imagetools({
|
|
|
|
|
// By default, directives are `?width=480;1024;1920&format=avif;webp;jpg`
|
2023-09-27 04:40:49 +00:00
|
|
|
// Now we change it to generate 5 variants instead - `avif/jpg` formats at `640/1280` + LQIP (Now as:run)
|
|
|
|
|
profiles: {
|
2024-12-02 03:14:16 +00:00
|
|
|
run: new URLSearchParams(
|
|
|
|
|
"?w=300;480;640;1024;1920&format=avif;webp;jpg&as=run:64"
|
|
|
|
|
),
|
|
|
|
|
},
|
|
|
|
|
}),
|
2023-04-09 20:44:45 +00:00
|
|
|
],
|
2024-12-02 03:14:16 +00:00
|
|
|
esbuild: {
|
|
|
|
|
target: "es2022",
|
|
|
|
|
},
|
2023-01-22 00:13:42 +00:00
|
|
|
test: {
|
2024-12-02 03:14:16 +00:00
|
|
|
include: ["src/**/*.{test,spec}.{js,ts}"],
|
|
|
|
|
mockReset: true,
|
|
|
|
|
},
|
|
|
|
|
css: {
|
|
|
|
|
devSourcemap: true,
|
|
|
|
|
preprocessorOptions: {
|
|
|
|
|
postcss: {
|
|
|
|
|
additionalData: `
|
|
|
|
|
@custom-media --below_small (width < 400px);
|
|
|
|
|
@custom-media --below_med (width < 700px);
|
|
|
|
|
@custom-media --below_large (width < 900px);
|
|
|
|
|
@custom-media --below_xlarge (width < 1200px);
|
2023-01-22 00:13:42 +00:00
|
|
|
|
2024-12-02 03:14:16 +00:00
|
|
|
@custom-media --above_small (width > 400px);
|
|
|
|
|
@custom-media --above_med (width > 700px);
|
|
|
|
|
@custom-media --above_large (width > 900px);
|
|
|
|
|
@custom-media --above_xlarge (width > 1200px);
|
|
|
|
|
`,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|