New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

astro-vercel-image

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astro-vercel-image

A way to leverage Vercel's Image Optimization API in Astro

  • 1.0.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Vercel Image Optimization for Astro

This is an integration for Astro that adds support for Vercel Image Optimization. Note: This integration currently does not support using the Vercel Adapter, to do that please referance the Vercel Image Optimization blog for more info.

Installation

npm install astro-vercel-image

Usage

There is two things to setup with this integration, the first is to add the astro-vercel-image plugin to your astro.config.mjs file. See Vercel Image Optimization Docs for more info on the options.

export default {
  integrations: [
    vercelImages({
      sizes: [640, 750, 828, 1080, 1200],
      domains: [],
      minimumCacheTTL: 60,
      formats: ["image/avif", "image/webp"],
      remotePatterns: [
        {
          protocol: "https",
          hostname: "^avatars1\\.githubusercontent\\.com$",
          pathname: "^/u/578259",
        },
      ],
    }),
  ],
};

The second thing to do is import the VercelImage component from astro-vercel-image/VercelImage.astro and use it in your components. Note: The VercelImage component width needs to in the list of sizes in the astro.config.mjs file.

---
import VercelImage from "astro-vercel-image/VercelImage.astro";
---

<div>
  <VercelImage src="/cat-image.jpg" alt="A photo of a cat" width={640} />
</div>

License

MIT

Keywords

FAQs

Package last updated on 14 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc