vue-responsive-img-helpers

A small Vue.js plugin which adds 3 methods to the Vue global scope used in creating img src, srcset and sizes attributes.


Keywords
vue, imgx, bulma, responsive, img, image, src, srcset, sizes
License
MIT
Install
npm install vue-responsive-img-helpers@2.0.1

Documentation

Vue Responsive Image Helpers

This is just a simple vue plugin to make working with (responsive) images a bit easier.

Keep in mind that it is meant mostly for personal use, and it is at the moment tailored for Bulma's breakpoints and imgix API.

Usage

The plugin adds 3 simple utility functions to the Vue global scope which helps you create values for img src, srcset, and sizes attributes. ###$createSrc(src, [options])

  • src: Base URL for the image
  • [options]: {width = 1600, fit = 'crop', heightRatio = .5625, suffix = ''} ###$createSrcSet(src, [options])
  • src: Base URL for the image
  • [options]: {fit = 'crop', heightRatio = .5625, max = 1600, min = 100, increment = 100, suffix = ''} ###$createSizes([options])
  • [options]: {desktop = '50vw', tablet = '75vw', mobile = '100vw'}

Sorry for the simple documentation. Then again it's mostly meant for personal use.