Skip to content

This plugin lazy loads image processed by gatsby-remark-im ages plugin

Notifications You must be signed in to change notification settings

1kohei1/gatsby-remark-lazy-load

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gatsby-remark-lazy-load

Lazyloads images processed by gatsby-remark-images with using lazysizes

The plugin makes lazyload possible by:

  • Move src and srcset to data-src and data-srcset respectively.
  • Add class lazyload to img tag.

lazysizes has to be installed to make this plugin work.

Install

npm install --save gatsby-remark-lazy-load

npm install --save lazysizes

How to use

// In your gatsby-config.js
plugins: [
  {
    resolve: `gatsby-transformer-remark`,
    options: {
      plugins: [
        {
          resolve: `gatsby-remark-images`,
        },
        `gatsby-remark-lazy-load`,
      ]
    }
  }
]
// In your gatsby-browser.js
import 'lazysizes'

Contribution

This is a minimum plugin. Please make an issue when you need more functionalities or code doesn't work!

About

This plugin lazy loads image processed by gatsby-remark-im ages plugin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published