Skip to content

Latest commit

Β 

History

History
108 lines (76 loc) Β· 3.28 KB

File metadata and controls

108 lines (76 loc) Β· 3.28 KB

NPM Version NPM Downloads

πŸͺ„ πŸ–ΌοΈ Magic Image

Magic Image is a modern, flexible image component for Nuxt applications. It wraps the best features of Unlazy and Nuxt Image into a single, ready-to-use Nuxt module. With Magic Image, you can effortlessly integrate advanced image handling capabilities into your project and benefit from dynamic sizing and best practice lazy loading.


✨ Key Benefits

  • 🌟 Auto-lazy Loading: Optimize load times with automatic lazy loading.
  • πŸ“ Dynamic Sizing: Automatically adjust image sizes for different devices.
  • ⚑ Optimized Loading: Deliver the most efficient images for your users.
  • πŸ”— Unified API: A single API for all your favorite image CDNs.
  • πŸ“¦ Extended Providers:
    • πŸŽ₯ MUX Video Thumbnails: Seamlessly fetch video thumbnails from MUX (coming soon) (Documentation).
    • πŸ›οΈ Shopify Image CDN: Support for Shopify images (coming soon) (Documentation).

πŸ“¦ Install

Install the package using your preferred package manager:

# npm
npm install @maas/magic-image

# pnpm
pnpm add @maas/magic-image

# yarn
yarn add @maas/magic-image

βš™οΈ Configure

To use Magic Image in your Nuxt app, register it as a module and configure it in your nuxt.config.ts file. Below is an example configuration:

export default defineNuxtConfig({
  modules: ['@maas/magic-image'],
  magicImage: {
    sizes: '256w:256px 960w:960px 1440w:1440px', // optional srcset custom sizes
    // See: https://image.nuxt.com/get-started/configuration
    image: {
      provider: 'unsplash',
      unsplash: {
        baseURL: '',
        modifiers: {
          auto: 'format,compress',
        },
      },
    },
    // See: https://unlazy.byjohann.dev/integrations/nuxt.html#module-options
    unlazy: {
       ssr: true,
    },
  },
});

πŸ”§ Usage

Magic Image provides a unified API for all your image needs. Here’s an example of how to use it in a Nuxt component:

<template>
  <div>
    <magic-image src="https://images.unsplash.com/photo-1694444070793-13db645409f4" />
  </div>
</template>

πŸš€ Features

  1. πŸ”— Seamless Integration: Combines the power of Unlazy and Nuxt Image into one package.
  2. πŸ“¦ Customizable Providers: Support for popular CDNs, including Unsplash, MUX, and Shopify (coming soon).
  3. βš™οΈ Flexibility: Easily configure sizes, lazy loading, and more.
  4. ⚑ Performance Optimization: Automatically delivers optimized images for a better user experience.

πŸ—ΊοΈ Roadmap

  • Add MUX Video Thumbnail support.
  • Shopify Image CDN integration.

πŸ› Found a Bug?

If you see something that doesn't look right, submit a bug report.

See it. Say it. Sorted.


πŸ“„ License

MIT License Β© 2024-PRESENT Magic as a Service GmbH