Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/arnellebalane/parcel-plugin-data-src

ParcelJS plugin to bundle resources defined in data-* attributes
https://github.com/arnellebalane/parcel-plugin-data-src

hacktoberfest npm-package parcel parceljs-plugin

Last synced: 3 months ago
JSON representation

ParcelJS plugin to bundle resources defined in data-* attributes

Lists

README

        

# 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

```bash
$ npm install --save-dev parcel-plugin-data-src
```

## Example

```html


```

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