parcel-plugin-data-src
ParcelJS plugin to bundle resources defined in data-src
and data-srcset
attributes.
This is particularly useful when doing lazyloading of images, which doesn't
directly place the image path in the src
attribute.
Installation
$ npm install --save-dev parcel-plugin-data-src
Example
By default, Parcel will only bundle ./images/image-placeholder.jpg
since it's
defined in the src
attribute.
Using this plugin, the following resosurces that are defined in data-srcset
and data-src
will also be bundled.
./images/image-lg.webp
./images/image-md.webp
./images/image-sm.webp
./images/image-lg.jpg
./images/image-md.jpg
./images/image-sm.jpg
License
MIT License