gatsby-mongodb-lazy-load

0.1.0 • Public • Published

@sekmet/gatsby-wpcontent-lazy-load

Lazyloads images processed by gatsby-tranformer-wpcontent 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 @sekmet/gatsby-wpcontent-lazy-load

npm install --save lazysizes

How to use

// In your gatsby-config.js
plugins: [
  {
    resolve: `gatsby-tranformer-wpcontent`,
    options: {
      plugins: [
        `@sekmet/gatsby-wpcontent-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!

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.0
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.0
    0

Package Sidebar

Install

npm i gatsby-mongodb-lazy-load

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

2.28 kB

Total Files

3

Last publish

Collaborators

  • sekmet