Skip to content

bartdominiak/vue-lazy

Repository files navigation

npm versionnpm bundle sizelicense

vue-lazy

Lightweight Image/Picture lazyload based on Intersection API.

About

Please note that this lib is on very early stage.

Storybook

Benefits

  • Lightweight
  • Picture tag support

Installation & Usage

Vue@3 version

Will be added soon

Vue@2 version

Installation

 yarn add vue-lazy // or npm install vue-lazy 

Usage - Globally

importVuefrom'vue'importVueLazyfrom'vue-lazy'import'vue-lazy/dist/vue-lazy.css'Vue.use(VueLazy)

Usage - Locally

import{LazyImage}from'vue-lazy'import'vue-lazy/dist/vue-lazy.css'exportdefault{components: { LazyImage }}

Example usage

If you want to see live examples, please jump to Storybook page.

Image

<lazy-imagesrc="https://via.placeholder.com/250" alt="example aternative text" />

Image with known width (prevent jumping content on page)

<lazy-imagesrc="https://via.placeholder.com/250" alt="example aternative text" width="250" height="250" />

Picture

<lazy-imagesrc="https://via.placeholder.com/250" alt="example aternative text" tag="picture" ><sourcemedia="(min-width:1366px)" srcset="https://via.placeholder.com/1360x300"><sourcemedia="(min-width:1024px)" srcset="https://via.placeholder.com/1024x300"></lazy-image>

Development

Install necessary depandancies with yarn or npm

 yarn // or npm install 

Run Storybook for development mode

 yarn storybook:dev 

Release

 yarn release 

Contribution

If you have a feature request then feel free to start a new issue, or just grab existing one.

License

MIT

About

🔥 Lightweight Image/Picture lazyload based on Intersection API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published