Skip to content

Commit

Permalink
perf: optimize images on buildtime (lossless)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChecksumDev committed Aug 13, 2023
1 parent bd4be3e commit 61980e7
Show file tree
Hide file tree
Showing 4 changed files with 302 additions and 7 deletions.
3 changes: 2 additions & 1 deletion apps/gui/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';

export default defineConfig({
plugins: [sveltekit()]
plugins: [sveltekit(), ViteImageOptimizer()]
});
6 changes: 5 additions & 1 deletion apps/web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig, loadEnv } from 'vite';
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';

export default defineConfig(({ mode }) => {
// let env = loadEnv(mode, process.cwd(), '');
Expand All @@ -17,7 +18,10 @@ export default defineConfig(({ mode }) => {
// if (!env.GITHUB_CALLBACK_URL) throw new Error('BEATFORGE_GITHUB_CALLBACK_URL is not defined');

return {
plugins: [sveltekit()],
plugins: [
ViteImageOptimizer(),
sveltekit()
],
define: {
'import.meta.env.API_URL': JSON.stringify(env.API_URL),
'import.meta.env.GITHUB_CALLBACK_URL': JSON.stringify(env.GITHUB_CALLBACK_URL)
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
"prettier": "^3.0.1",
"prettier-plugin-svelte": "^3.0.3",
"prettier-plugin-tailwindcss": "^0.4.1",
"turbo": "^1.10.12"
"sharp": "^0.32.4",
"svgo": "^3.0.2",
"turbo": "^1.10.12",
"vite-plugin-image-optimizer": "^1.1.7"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit 61980e7

Please sign in to comment.