@mgcrea/astro-background-image

0.2.1 • Public • Published

@mgcrea/astro-background-image

Basic component to render a background image with Astro.

  • Leverages the getImage() helper from astro:assets to generate responsive image URLs.
  • Supports srcset and widths attributes.
npm install --dev @mgcrea/astro-background-image
# or
pnpm add --save-dev @mgcrea/astro-background-image

Usage

---
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>

Readme

Keywords

Package Sidebar

Install

npm i @mgcrea/astro-background-image

Weekly Downloads

2

Version

0.2.1

License

MIT

Unpacked Size

3.77 kB

Total Files

5

Last publish

Collaborators

  • mgcrea