routerino 2.5.0 → 2.5.1-rc1
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 +38 -31
- package/dist/routerino.js +255 -239
- package/dist/routerino.umd.cjs +1 -1
- package/package.json +1 -1
- package/routerino-forge.js +133 -51
- package/routerino-image.jsx +59 -23
- package/types/routerino.d.ts +101 -2
package/README.md
CHANGED
|
@@ -525,18 +525,21 @@ import { Image } from "routerino/image";
|
|
|
525
525
|
|
|
526
526
|
### Image Props
|
|
527
527
|
|
|
528
|
-
| Prop | Type | Required | Description
|
|
529
|
-
| --------------- | --------------------------- | -------- |
|
|
530
|
-
| `src` | string | ✅ | Image source URL
|
|
531
|
-
| `alt` | string | ✅ | Alt text for accessibility
|
|
532
|
-
| `priority` | boolean | ❌ | Override lazy loading for hero/LCP images
|
|
533
|
-
| `widths` | number[] | ❌ | Custom responsive widths (default: [480, 800, 1200, 1920])
|
|
534
|
-
| `sizes` | string | ❌ | Responsive sizes attribute (has smart default)
|
|
535
|
-
| `className` | string | ❌ | CSS classes (Tailwind/DaisyUI ready)
|
|
536
|
-
| `style` | object | ❌ | Inline styles
|
|
537
|
-
| `
|
|
538
|
-
| `
|
|
539
|
-
| `
|
|
528
|
+
| Prop | Type | Required | Description |
|
|
529
|
+
| --------------- | --------------------------- | -------- | ---------------------------------------------------------------- |
|
|
530
|
+
| `src` | string | ✅ | Image source URL (supports jpg, png, webp, avif, gif, bmp, tiff) |
|
|
531
|
+
| `alt` | string | ✅ | Alt text for accessibility |
|
|
532
|
+
| `priority` | boolean | ❌ | Override lazy loading for hero/LCP images |
|
|
533
|
+
| `widths` | number[] | ❌ | Custom responsive widths (default: [480, 800, 1200, 1920]) |
|
|
534
|
+
| `sizes` | string | ❌ | Responsive sizes attribute (has smart default) |
|
|
535
|
+
| `className` | string | ❌ | CSS classes (Tailwind/DaisyUI ready) |
|
|
536
|
+
| `style` | object | ❌ | Inline styles |
|
|
537
|
+
| `width` | number | ❌ | Explicit width attribute (CLS prevention) |
|
|
538
|
+
| `height` | number | ❌ | Explicit height attribute (CLS prevention) |
|
|
539
|
+
| `loading` | "lazy" \| "eager" | ❌ | Loading behavior (auto-set based on priority) |
|
|
540
|
+
| `decoding` | "sync" \| "async" \| "auto" | ❌ | Decode timing (default: "async") |
|
|
541
|
+
| `fetchpriority` | "high" \| "low" \| "auto" | ❌ | Fetch priority (auto-set based on priority) |
|
|
542
|
+
| `ref` | React.Ref | ❌ | Forwarded to the underlying `<img>` element |
|
|
540
543
|
|
|
541
544
|
### Image Usage Examples
|
|
542
545
|
|
|
@@ -926,7 +929,7 @@ export default defineConfig({
|
|
|
926
929
|
// useTrailingSlash: true, // Set to false for /about instead of /about/
|
|
927
930
|
// verbose: false,
|
|
928
931
|
// ssgCacheDir: "node_modules/.cache/routerino-forge", // SSG cache directory
|
|
929
|
-
//
|
|
932
|
+
// imageOptions: {}, // Customize image optimization (see Image Optimization below)
|
|
930
933
|
}),
|
|
931
934
|
],
|
|
932
935
|
});
|
|
@@ -955,38 +958,42 @@ export default defineConfig({
|
|
|
955
958
|
- Creates a 404.html page
|
|
956
959
|
- Skips dynamic routes (with `:param` syntax)
|
|
957
960
|
- SEO optimized: Complete HTML with meta tags
|
|
958
|
-
- Image optimization: Automatic blur placeholders (LQIP)
|
|
961
|
+
- Image optimization: Automatic responsive variants + blur placeholders (LQIP)
|
|
959
962
|
- Easy configuration: Works out of the box with Vite and minimal setup
|
|
960
963
|
|
|
961
964
|
#### Image Optimization
|
|
962
965
|
|
|
963
|
-
Routerino Forge
|
|
966
|
+
Routerino Forge automatically processes `<Image>` components during the build to generate responsive image variants and LQIP (Low Quality Image Placeholder) blur-up effects. Image optimization is always enabled when ffmpeg is available — no flag needed to turn it on. Use `imageOptions` to customize:
|
|
964
967
|
|
|
965
968
|
```js
|
|
966
969
|
routerinoForge({
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
placeholderSize: 20, //
|
|
972
|
-
blur: 4, // Blur radius for placeholder
|
|
973
|
-
maxSize: 10485760, //
|
|
974
|
-
minSize: 1024, //
|
|
975
|
-
cacheDir: "node_modules/.cache/routerino-forge",
|
|
970
|
+
baseUrl: "https://example.com",
|
|
971
|
+
imageOptions: {
|
|
972
|
+
widths: [480, 800, 1200, 1920], // Responsive widths to generate
|
|
973
|
+
formats: ["webp"], // Extra formats (webp is always generated)
|
|
974
|
+
placeholderSize: 20, // Height of LQIP placeholder in px
|
|
975
|
+
blur: 4, // Blur radius for LQIP placeholder
|
|
976
|
+
maxSize: 10485760, // Max source image size to process (10MB)
|
|
977
|
+
minSize: 1024, // Min source image size to process (1KB)
|
|
978
|
+
cacheDir: "node_modules/.cache/routerino-forge",
|
|
976
979
|
},
|
|
977
980
|
});
|
|
978
981
|
```
|
|
979
982
|
|
|
983
|
+
All keys in `imageOptions` are optional — omit any to keep the default.
|
|
984
|
+
|
|
980
985
|
**What it does:**
|
|
981
986
|
|
|
982
|
-
- Generates
|
|
983
|
-
-
|
|
984
|
-
-
|
|
985
|
-
-
|
|
986
|
-
-
|
|
987
|
-
-
|
|
987
|
+
- Generates responsive image variants at each configured width (WebP + original format)
|
|
988
|
+
- Generates LQIP blur placeholders (tiny base64 PNG shown while image loads)
|
|
989
|
+
- Anti-upscaling: never generates variants wider than the source image
|
|
990
|
+
- Caches generated variants to speed up subsequent builds
|
|
991
|
+
- Skips external URLs (http/https), data URIs, and SVGs
|
|
992
|
+
- Skips images below `minSize` or above `maxSize`
|
|
993
|
+
- Adds `width`/`height` attributes to `<img>` tags for CLS prevention
|
|
994
|
+
- Stale cache entries are automatically cleaned up (50 most recent kept)
|
|
988
995
|
|
|
989
|
-
**Note:** Image optimization requires `ffmpeg` to be installed on your system. Install with `brew install ffmpeg` (Mac), `apt install ffmpeg` (Debian/Ubuntu), or `choco install ffmpeg` (Windows). Without ffmpeg, the Image component still works but falls back to the original image without
|
|
996
|
+
**Note:** Image optimization requires `ffmpeg` to be installed on your system. Install with `brew install ffmpeg` (Mac), `apt install ffmpeg` (Debian/Ubuntu), or `choco install ffmpeg` (Windows). Without ffmpeg, the Image component still works but falls back to the original image without responsive variants or LQIP. A warning is shown during build if ffmpeg is not found but Image components are used.
|
|
990
997
|
|
|
991
998
|
##### CI/CD Setup for Image Optimization
|
|
992
999
|
|