@mgcrea/astro-background-image
v0.2.1
Published
Simple BackgroundImage component for astro
Readme
@mgcrea/astro-background-image
Basic component to render a background image with Astro.
- Leverages the
getImage()helper fromastro:assetsto generate responsive image URLs. - Supports
srcsetandwidthsattributes.
npm install --dev @mgcrea/astro-background-image
# or
pnpm add --save-dev @mgcrea/astro-background-imageUsage
---
import BackgroundImage from '@mgcrea/astro-background-image';
import heroSrc from "src/assets/hero.jpg";
---
<section id="hero" class="relative">
<BackgroundImage src={heroSrc} class="bg-cover">
<div>Hero</div>
</section>