@flowaccount/scully-plugin-lazy-load-picture-tag
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

scully-plugin-lazy-load-picture-tag

I wrote this as an 📎 angular-paperclip 📎 experiment from the talk by Misko Hevery (@mhevery) from the Keynote in NGCONF 2019

It is a lazy effort to lazy load images that lies int the <picture> tags. I am not sure why, since the srcset probably does that for you, but lighthouse stills complains about it. And instead of replacing all the possible tags in the code, I chose to lazy-load it using the adaptation for lazyload package that does the img tag instead.

You can specify the placeholder image when lazyloading the img, which is a nice touch for mobile slow 3g/4g 😄

Read more about the experiment at this article --> Angular Paperclip Experiment

Installation

To install this library with npm run

npm install scully-plugin-lazy-load-picture-tag --save-dev

or with yarn

yarn add scully-plugin-lazy-load-picture-tag --dev

Usage

  • Add this to your scully.config.ts file
import { getLazyLoadPictureTagPlugin } from '@flowaccount/scully-plugin-lazy-load-picture-tag';

const postRenderers = [
  getLazyLoadPictureTagPlugin({
    imagePlaceholder:
      'https://flowaccountcdn.com/new_landing/image/White_2px.jpg'
  })
];

export const config: ScullyConfig = {
  routes: {},
  defaultPostRenderers: postRenderers
};
yarn scully

This is an adaptation from scully-plugin-disable-angular

Package Sidebar

Install

npm i @flowaccount/scully-plugin-lazy-load-picture-tag

Weekly Downloads

119

Version

0.0.3

License

MIT

Unpacked Size

8.81 kB

Total Files

8

Last publish

Collaborators

  • supawan
  • purett
  • panya_b_flowaccount
  • wickyorama
  • narongok