Gathering detailed insights and metrics for nuxt-lazyimages
Gathering detailed insights and metrics for nuxt-lazyimages
Gathering detailed insights and metrics for nuxt-lazyimages
Gathering detailed insights and metrics for nuxt-lazyimages
npm install nuxt-lazyimages
Typescript
Module System
Node Version
NPM Version
62.8
Supply Chain
90.6
Quality
75.5
Maintenance
100
Vulnerability
98.9
License
JavaScript (84.73%)
TypeScript (12.01%)
Vue (3.26%)
Total Downloads
15,827
Last Day
14
Last Week
181
Last Month
896
Last Year
9,993
MIT License
1 Stars
7 Commits
1 Branches
1 Contributors
Updated on Nov 18, 2024
Latest Version
0.2.1
Package Id
nuxt-lazyimages@0.2.1
Unpacked Size
45.93 kB
Size
11.53 kB
File Count
16
NPM Version
10.2.4
Node Version
21.6.0
Published on
Jan 22, 2024
Cumulative downloads
Total Downloads
Last Day
-6.7%
14
Compared to previous day
Last Week
7.1%
181
Compared to previous week
Last Month
74%
896
Compared to previous month
Last Year
93.1%
9,993
Compared to previous year
1
lazysizes
in your Nuxt 3 projectDefer offscreen images audit
audit con LighthouseAdd nuxt-lazyimages
to your project:
1npm install --save-dev nuxt-lazyimages 2 3# Using yarn 4yarn add --dev nuxt-lazyimages
Add it to the modules
array in your nuxt.config.ts
:
1import { defineNuxtConfig } from 'nuxt' 2 3export default defineNuxtConfig({ 4 modules: ['nuxt-lazyimages'] 5})
Add the default class
lazyload
to your image in conjunction with a data-src
and/or data-srcset
attribute.
1<!-- non-responsive: --> 2<img data-src="image.jpg" class="lazyload" />
1<!-- responsive example with automatic sizes calculation: --> 2<img 3 data-sizes="auto" 4 data-src="image2.jpg" 5 data-srcset="image1.jpg 300w, 6 image2.jpg 600w, 7 image3.jpg 900w" class="lazyload" />
✨ That's it!
If you wish to change the configuration of Lazysizes, open your nuxt.config.ts
or nuxt.config.js
file, and set the configuration using the lazyimages
object:
1import { defineNuxtConfig } from 'nuxt';
2
3export default defineNuxtConfig({
4 modules: [
5 'nuxt-lazyimages'
6 ],
7 lazyimages: {
8 // Default configuration:
9 lazyClass: 'lazyload',
10 preloadAfterLoad: false,
11 loadedClass: 'lazyloaded',
12 loadingClass: 'lazyloading',
13 preloadClass: 'lazypreload',
14 errorClass: 'lazyerror',
15 autosizesClass: 'lazyautosizes',
16 fastLoadedClass: 'ls-is-cached',
17 iframeLoadMode: 0,
18 srcAttr: 'data-src',
19 srcsetAttr: 'data-srcset',
20 sizesAttr: 'data-sizes',
21 minSize: 40,
22 customMedia: {},
23 expFactor: 1.5,
24 hFac: 0.8,
25 loadMode: 2,
26 loadHidden: true,
27 ricTimeout: 0,
28 throttleDelay: 125
29 }
30});
Please refer to LazySizes' JS documentation to know more about each option.
Currently supported Lazysizes plugins:
Open your nuxt.config.ts
or nuxt.config.js
file and activate whichever plugin you prefer:
1export default defineNuxtConfig({ 2 lazyimages: { 3 plugins: { 4 bgset: true 5 } 6 } 7})
npm install
npm run dev:prepare
npm run dev
to start playground in development modeThis simple library is a simple wrapper around Alexander Farkas' LazySizes super-fast lazyloader. All credit goes to him.
Published under the MIT License.
No vulnerabilities found.