0.0.14 • Published 3 years ago

vue-pictureset v0.0.14

Weekly downloads
102
License
-
Repository
-
Last release
3 years ago

vue-pictureset

v0.0.3 Vue plugin to manage all pictures in your project. Handle all srcsets in a picture tag with a simple and lightweight plugin. You can specify sizes for every media query or select a ratio based on screen width. It will generate src file for the defined media queries and for 1x, 2x, 3x pixel ratio. It will also convert your image in webp format (wherever possible), using the input format as fallback. It works with Contentful and Storyblok images API. Custom resize will work soon.

Installation

npm i vue-pictureset

or

yarn add vue-pictureset

Then you can install your plugin globally with

...
import PictureSet from 'vue-pictureset'

Vue.use(PictureSet, {
  imagesApi: 'contentful'
})
...

At this moment only "contentful" is available as Image Api

Usage

You can use the plugin as a simple component in Vue.

<picture-set src="YOUR_IMAGE_URL" alt="YOUR_IMAGE_ALT" title="YOUR_IMAGE_TITLE" :size="0.75" />

Options

ParameterRequiredTypeDefaultDescription
srctrueStringSource url of your image
altStringAlternative description of your image
titleStringTitle of your image
sizetrueArray | NumberIf is a number it will use the value as ratio for the higher screen size in mediaQuery param. Ex: and mediaQueries is 1200, 1024, 768 it will return images with the following width: 12000.75, 10240.75, 768*0.75 It can also be an array of media queries with width and height defined. Ex: size = { 1200: { w: 1000, h: 500 } }, { 768: { w: 300, h: 150 } } If you're using the Contentful plugin you can also specify the fit property inside the object. Ex: size = { 1200: { w: 1000, h: 500, fit: 'fill' } }, { 768: { w: 300, h: 150, fit: 'fill' } }
mediaQueriesArray 1980 , 1536 , 1280 , 1024 , 768 , 640 Array of media queries
QualityObject{ webp : 75 , default : 80 }Define the quality to be use in webp format and input format.
imgStyleObjectStyle object for the img tag.
imgClassStringClass of img tag
loadingStringlazyLoading property of img tag. Accepted values are "auto", "lazy", "eager"

Coming very very soon

Prismic and Storyblok support

Coming soon

Integrated resize tool for every image. Skeleton as placeholder for image loading. Support to various images api systems.

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.1.0

3 years ago