@inglorious/ssx 1.2.0 → 1.3.1
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 +20 -16
- package/package.json +7 -3
- package/src/build/vite-config.js +7 -1
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
|
|
@@ -400,7 +408,7 @@ SSX provides a simple CLI for building and developing:
|
|
|
400
408
|
Builds your static site:
|
|
401
409
|
|
|
402
410
|
```bash
|
|
403
|
-
ssx build [options]
|
|
411
|
+
pnpm ssx build [options]
|
|
404
412
|
|
|
405
413
|
Options:
|
|
406
414
|
-c, --config <file> Config file (default: "site.config.js")
|
|
@@ -410,12 +418,20 @@ Options:
|
|
|
410
418
|
-f, --force Force clean build, ignore cache
|
|
411
419
|
```
|
|
412
420
|
|
|
421
|
+
### `preview`
|
|
422
|
+
|
|
423
|
+
Serves the built static site on port 3000 through the `serve` NPM package.
|
|
424
|
+
|
|
425
|
+
```bash
|
|
426
|
+
pnpm preview
|
|
427
|
+
```
|
|
428
|
+
|
|
413
429
|
### `ssx dev`
|
|
414
430
|
|
|
415
|
-
Starts development server with hot reload:
|
|
431
|
+
Starts the Vite development server on port 3000 with hot reload:
|
|
416
432
|
|
|
417
433
|
```bash
|
|
418
|
-
ssx dev [options]
|
|
434
|
+
pnpm ssx dev [options]
|
|
419
435
|
|
|
420
436
|
Options:
|
|
421
437
|
-c, --config <file> Config file (default: "site.config.js")
|
|
@@ -423,18 +439,6 @@ Options:
|
|
|
423
439
|
-p, --port <port> Dev server port (default: 3000)
|
|
424
440
|
```
|
|
425
441
|
|
|
426
|
-
### Package.json Scripts
|
|
427
|
-
|
|
428
|
-
```json
|
|
429
|
-
{
|
|
430
|
-
"scripts": {
|
|
431
|
-
"dev": "ssx dev",
|
|
432
|
-
"build": "ssx build",
|
|
433
|
-
"preview": "pnpm dlx serve dist"
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
```
|
|
437
|
-
|
|
438
442
|
---
|
|
439
443
|
|
|
440
444
|
## Project Structure
|
|
@@ -636,7 +640,7 @@ Check out these example projects:
|
|
|
636
640
|
## Roadmap
|
|
637
641
|
|
|
638
642
|
- [x] TypeScript support
|
|
639
|
-
- [
|
|
643
|
+
- [x] Image optimization
|
|
640
644
|
- [ ] API routes (serverless functions)
|
|
641
645
|
- [ ] MDX support
|
|
642
646
|
- [ ] i18n helpers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/ssx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
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",
|
|
@@ -44,11 +44,15 @@
|
|
|
44
44
|
"fast-xml-parser": "^5.3.3",
|
|
45
45
|
"glob": "^13.0.0",
|
|
46
46
|
"rollup-plugin-minify-template-literals": "^1.1.7",
|
|
47
|
+
"sharp": "^0.34.5",
|
|
48
|
+
"svgo": "^4.0.0",
|
|
47
49
|
"vite": "^7.1.3",
|
|
48
|
-
"
|
|
50
|
+
"vite-plugin-image-optimizer": "^2.0.3",
|
|
51
|
+
"@inglorious/web": "4.0.2"
|
|
49
52
|
},
|
|
50
53
|
"devDependencies": {
|
|
51
54
|
"prettier": "^3.6.2",
|
|
55
|
+
"serve": "^14.2.1",
|
|
52
56
|
"vitest": "^1.6.1",
|
|
53
57
|
"@inglorious/eslint-config": "1.1.1"
|
|
54
58
|
},
|
|
@@ -62,6 +66,6 @@
|
|
|
62
66
|
"test": "vitest run",
|
|
63
67
|
"dev": "node ./bin/ssx.js dev -r ./src/__fixtures__",
|
|
64
68
|
"build": "node ./bin/ssx.js build -r ./src/__fixtures__",
|
|
65
|
-
"preview": "
|
|
69
|
+
"preview": "serve dist"
|
|
66
70
|
}
|
|
67
71
|
}
|
package/src/build/vite-config.js
CHANGED
|
@@ -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
|
-
|
|
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
|