New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-webp-image

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-webp-image

A vue directive help check browser webp support and use the appropriate image format.

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

vue-webp-image

Version Downloads License

A vue directive help check browser webp support and use the appropriate image format.

  • Compatible with Vue3 and Vue2
  • Lightweight (700b)

Installation

npm install vue-webp-image --save

Usage

main.js
  • Vue3
import { createApp } from 'vue';
import App from './App.vue';
import VueWebpImage from 'vue-webp-image';

const app = createApp(App);
app.use(VueWebpImage);
app.mount('#app');
  • Vue2
import Vue from 'vue';
import VueWebpImage from 'vue-webp-image';

Vue.use(VueWebpImage);
Component
  • v-webp:src - use with img tag
<!-- local image -->
<img
  v-webp:src="require('./assets/image.webp')"
  :src="require('./assets/image.jpg')"
/>
<!-- online image -->
<img
  v-webp:src="'https://www.xxx.com/image.webp'"
  :src="'https://www.xxx.com/image.jpg'"
/>
  • v-webp:bg - use css background-image property
<div
  class="bg-container"
  v-webp:bg="require('./assets/image.webp')"
></div>

<style>
.bg-container {
  background-image: url('./assets/image.jpg');
}
</style>
  • v-webp:bgs - use css background-image property (put webp source and original source in an array)
<div
  v-webp:bgs="[require('./assets/image.webp'), require('./assets/image.jpg')]"
></div>

Keywords

FAQs

Package last updated on 29 Nov 2021

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc