Astro
Here're the steps to integrate Urami with Astro.
Quick install
Use astro add to install @urami/astro package. This will automatically install dependencies, and add integration to astro.config.mjs.
sh
$ npx astro add @urami/astro$ npx astro add @urami/astrosh
$ pnpm astro add @urami/astro$ pnpm astro add @urami/astrosh
$ yarn astro add @urami/astro$ yarn astro add @urami/astroManual install
First, install @urami/astro package.
sh
$ npm add @urami/astro$ npm add @urami/astrosh
$ pnpm add @urami/astro$ pnpm add @urami/astrosh
$ yarn add @urami/astro$ yarn add @urami/astroThen, apply integration to astro.config.mjs. It's important to have output: 'server' in order to use Urami.
js
import { defineConfig } from "astro/config";
import urami from "@urami/astro";
// https://astro.build/config
export default defineConfig({
output: "server",
integrations: [
urami(),
],
});import { defineConfig } from "astro/config";
import urami from "@urami/astro";
// https://astro.build/config
export default defineConfig({
output: "server",
integrations: [
urami(),
],
});Image component
Import Image component from @urami/astro and use it like next/image.
astro
---
import Image from '@urami/astro/image'
---
<Image
src="https://httpmemes.netlify.app/200.jpg"
width={801}
height={801}
alt="Tom Scott"
class="rounded-xl shadow-md"
/>---
import Image from '@urami/astro/image'
---
<Image
src="https://httpmemes.netlify.app/200.jpg"
width={801}
height={801}
alt="Tom Scott"
class="rounded-xl shadow-md"
/>Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
src | string | - | ✅ | Source of the image |
width | number | - | ✅ | Width of the image |
height | number | - | ❌ | Height of the image (Specify this will results in less layout shift) |
quality | number | 75 | ❌ | Quality of the image |
formats | string[] | ['webp', 'jpg'] | ❌ | Formats to generate for the <picture> element |