Skip to content

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

License

Notifications You must be signed in to change notification settings

colsen1991/vue-responsive-img-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published