Community Plugin
View plugin on GitHub@sekmet/gatsby-wpcontent-lazy-load
Lazyloads images processed by gatsby-tranformer-wpcontent with using lazysizes
The plugin makes lazyload possible by:
- Move
srcandsrcsettodata-srcanddata-srcsetrespectively. - Add class
lazyloadtoimgtag.
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!