Socket
Book a DemoInstallSign in
Socket

@teamnovu/vue-responsive-image

Package Overview
Dependencies
Maintainers
3
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teamnovu/vue-responsive-image

Make every Image Responsive to Shrink your Bundle Size

latest
npmnpm
Version
0.0.1
Version published
Maintainers
3
Created
Source

vue-responsive-image

npm version License

Make every Image Responsive to Shrink your Bundle Size

📖 Release Notes

Intro

DEMO

Vue Responsive Image helps you in making every image on your website responsive. Inspired by tailwindcss breakpoints it always scales the image down to fit the current breakpoint but still leaves you the flexibility to scale it down even further.

Requirements

Nothing, just go for it.

Setup

  • Add @teamnovu/vue-responsive-image as a dependency to your project
yarn add @teamnovu/vue-responsive-image

# or npm install @teamnovu/vue-responsive-image
  • Add the following code to your main.js
import ResponsiveImage from '@teamnovu/vue-responsive-image'

Vue.component('ResponsiveImage', ResponsiveImage)

Usage

Just use the <ResponsiveImage /> component where you would have a normal <img /> tag and pass in the props as follows.

<ResponsiveImage
  src="https://source.unsplash.com/random/{w}x1000"
  :screens="{
    xs: '360px',
    sm: '640px',
    md: '768px',
    lg: '1024px',
    xl: '1280px'
  }"
  :max-width="3000"
  sizes="w-90vw md:w-60vw xl:w-50vw"
/>

Available Props

OptionTypeDefaultOptionsDescription
srcStringnonewidth: {w}The source to be used for the image with {w} where the width should go.
maxWidthNumber2560Any NumberThe maximum width used to calculate the image width on the biggest breakpoint.
screensObject{ sm: '640px', md: '768px', lg: '1024px', xl: '1280px' }An key pixel value pairsThe breakpoints to be used.
sizesString100vw for each breakpointAny vw value for each breakpointViewport-width to further shrink image on each breakpoint.

Development

  • Clone this repository
  • Install dependencies using yarn install
  • Start development server using yarn dev

Release

  • yarn release
  • npm publish

Features Planned

  • Image Ratio
  • Breakpoints from tailwindcss config

License

MIT License

Copyright (c) teamnovu

FAQs

Package last updated on 22 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts