Last active
March 9, 2024 19:06
-
-
Save drjamesj/57decae087599ea8e4e41e0ee8477905 to your computer and use it in GitHub Desktop.
Use vite-imagetools in SvelteKit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import MyFancyImg from '$lib/images/large_image.png?w=400&format=webp'; | |
</script> | |
<img | |
alt="Here is my optimised image in next gen format" | |
width="400" | |
height="400" | |
src={MyFancyImg} | |
/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { sveltekit } from '@sveltejs/kit/vite'; | |
import { defineConfig } from 'vite'; | |
import { imagetools } from 'vite-imagetools'; | |
export default defineConfig({ | |
plugins: [sveltekit(), imagetools()] | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
npm install vite-imagetools