@inglorious/ssx 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -31,6 +31,7 @@ SSX takes your entity-based web apps and generates optimized static HTML with fu
31
31
  - **Lazy-loaded routes** - Code splitting automatically
32
32
  - **lit-html hydration** - Interactive UI without the bloat
33
33
  - **TypeScript Ready** - Write your pages and entities in TypeScript.
34
+ - **Image Optimization** - Automatic compression for static assets.
34
35
 
35
36
  ### 🚀 Production Ready
36
37
 
@@ -389,6 +390,13 @@ api.notify("navigate", {
389
390
 
390
391
  Routes are lazy-loaded on demand, keeping initial bundle size small.
391
392
 
393
+ ### 🖼️ Image Optimization
394
+
395
+ SSX includes built-in image optimization using `vite-plugin-image-optimizer`.
396
+
397
+ - **Automatic compression** - PNG, JPEG, GIF, SVG, WebP, and AVIF are compressed at build time.
398
+ - **Lossless & Lossy** - Configurable settings via `vite` config in `site.config.js`.
399
+
392
400
  ---
393
401
 
394
402
  ## CLI
@@ -636,7 +644,7 @@ Check out these example projects:
636
644
  ## Roadmap
637
645
 
638
646
  - [x] TypeScript support
639
- - [ ] Image optimization
647
+ - [x] Image optimization
640
648
  - [ ] API routes (serverless functions)
641
649
  - [ ] MDX support
642
650
  - [ ] i18n helpers
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inglorious/ssx",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "Server-Side-X. Xecution? Xperience? Who knows.",
5
5
  "author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
6
6
  "license": "MIT",
@@ -49,6 +49,9 @@
49
49
  },
50
50
  "devDependencies": {
51
51
  "prettier": "^3.6.2",
52
+ "sharp": "^0.34.5",
53
+ "svgo": "^4.0.0",
54
+ "vite-plugin-image-optimizer": "^2.0.3",
52
55
  "vitest": "^1.6.1",
53
56
  "@inglorious/eslint-config": "1.1.1"
54
57
  },
@@ -1,6 +1,7 @@
1
1
  import path from "node:path"
2
2
 
3
3
  import { mergeConfig } from "vite"
4
+ import { ViteImageOptimizer } from "vite-plugin-image-optimizer"
4
5
 
5
6
  // import { minifyTemplateLiterals } from "rollup-plugin-minify-template-literals"
6
7
 
@@ -19,7 +20,12 @@ export function createViteConfig(options = {}) {
19
20
  {
20
21
  root: rootDir,
21
22
  publicDir: path.resolve(process.cwd(), rootDir, publicDir),
22
- // plugins: [minifyTemplateLiterals()], // TODO: minification breaks hydration. The footprint difference is minimal after all
23
+ plugins: [
24
+ // minifyTemplateLiterals(), // TODO: minification breaks hydration. The footprint difference is minimal after all
25
+ ViteImageOptimizer({
26
+ // Options can be overridden by the user in site.config.js via the `vite` property
27
+ }),
28
+ ],
23
29
  build: {
24
30
  outDir,
25
31
  emptyOutDir: false, // Don't delete HTML files we already generated