0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/.changeset/sour-frogs-shout.md
Julien Barbay d6b4943764
feat(assets): support remote images (#7778)
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Co-authored-by: Princesseuh <princssdev@gmail.com>
Co-authored-by: Erika <3019731+Princesseuh@users.noreply.github.com>
2023-08-17 13:10:50 +02:00

693 B

astro
patch

Added support for optimizing remote images from authorized sources when using astro:assets. This comes with two new parameters to specify which domains (image.domains) and host patterns (image.remotePatterns) are authorized for remote images.

For example, the following configuration will only allow remote images from astro.build to be optimized:

// astro.config.mjs
export default defineConfig({
  image: {
    domains: ["astro.build"],
  }
});

The following configuration will only allow remote images from HTTPS hosts:

// astro.config.mjs
export default defineConfig({
  image: {
    remotePatterns: [{ protocol: "https" }],
  }
});