@svelte-drama/vite-plugin-image-metadata
v1.0.4
Published
A Vite plugin that imports image files with their dimensions. Append `?image` to any image import to get back the `src`, `width`, and `height`.
Downloads
536
Readme
vite-plugin-image-metadata
A Vite plugin that imports image files with their dimensions. Append ?image to any image import to get back the src, width, and height.
Installation
npm install vite-plugin-image-metadataSetup
// vite.config.ts
import { defineConfig } from 'vite'
import imageMetadata from 'vite-plugin-image-metadata'
export default defineConfig({
plugins: [imageMetadata()]
})Usage
import Eevee from './133_us.png?image'
const { height, width, src } = Eevee