unplugin-vue-auto-img
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

unplugin-vue-auto-img

NPM version

Install

npm i unplugin-vue-auto-img -D
Vite
// vite.config.ts
import Image from 'unplugin-vue-auto-img/vite'

export default defineConfig({
  plugins: [
    Image({ /* options */ }),
  ],
})

Example: playground/


Rollup
// rollup.config.js
import Image from 'unplugin-vue-auto-img/rollup'

export default {
  plugins: [
    Image({ /* options */ }),
  ],
}


Webpack
// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('unplugin-vue-auto-img/webpack')({ /* options */ }),
  ],
}


Nuxt
// nuxt.config.js
export default {
  buildModules: [
    ['unplugin-vue-auto-img/nuxt', { /* options */ }],
  ],
}

This module works for both Nuxt 2 and Nuxt Vite


Vue CLI
// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('unplugin-vue-auto-img/webpack')({ /* options */ }),
    ],
  },
}


Usage

unplugin-vue-auto-img auto import your image from assets/images by default to your Vue component.

You can only use image variables using camelCase.

--- aseets
  --- images
    --- logo.png
--- App.vue
--- src/App.vue ---
<template>
  <div>
    <img :src="Logo">
  </div>
</template>

License

MIT

Package Sidebar

Install

npm i unplugin-vue-auto-img

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

466 kB

Total Files

30

Last publish

Collaborators

  • lyric-zemin