- uses: actions/checkout@v7
- uses: oven-sh/setup-bun@v2
- name: Cache dependencies and build artifacts
- uses: actions/cache@v4
+ uses: actions/cache@v5
with:
path: |
- ~/.bun/install/cache
node_modules/.astro
key: ${{ runner.os }}-${{ hashFiles('bun.lock') }}-${{ hashFiles('public/**/*.{jpg,jpeg,png,webp,avif,svg,gif}', 'content/**/*.{jpg,jpeg,png,webp,avif,svg,gif}', 'src/assets/**/*.{jpg,jpeg,png,webp,avif,svg,gif,ico}') }}
restore-keys: |
avif: { quality: 50, effort: 2 },
},
},
- dangerouslyProcessSVG: true,
},
vite: {
build: {
This is incredible for the little guy: run your own model, privately, without the need for massive infrastructure.
-<Figure
- image={r1OniPhone}
- alt="R1 running locally on an iPhone"
- formats={['webp']}
->
+<Figure image={r1OniPhone} alt="R1 running locally on an iPhone" plain>
A distilled version of R1 running locally on an iPhone. Source:
[@localghost](https://x.com/localghost/status/1882109711732154387).
</Figure>
alt: string;
formats?: string[];
layout?: 'constrained' | 'full-width' | 'fixed' | 'none';
+ /** Serve the image as-is (no variants). Required for animated images
+ * and recommended for SVGs, which are already resolution-independent. */
+ plain?: boolean;
}
-const { image, alt, formats = ['webp'], layout } = Astro.props;
+const { image, alt, formats = ['webp'], layout, plain = false } = Astro.props;
+
+// SVGs are vector-based: generating per-breakpoint raster-style copies
+// multiplies the shipped bytes with no visual gain. Animated images
+// cannot be resized by the image service and balloon into huge
+// lossless fallbacks. Both are served as-is.
+const isSvg = image.src?.endsWith('.svg');
+const serveAsIs = plain || isSvg;
---
<figure>
- <Picture
- src={image}
- alt={alt}
- formats={formats}
- layout={layout}
- data-pagefind-index-attrs="alt"
- />
+ {
+ serveAsIs ? (
+ <img
+ src={image.src}
+ alt={alt}
+ data-pagefind-index-attrs="alt"
+ loading="lazy"
+ />
+ ) : (
+ <Picture
+ src={image}
+ alt={alt}
+ formats={formats}
+ layout={layout}
+ data-pagefind-index-attrs="alt"
+ />
+ )
+ }
<figcaption><slot /></figcaption>
</figure>