Parses HTML files to find
<img>
tags and adds an attribute to them which contains their Base64 representation.
https://exuanbo.github.io/gulp-lqip-base64/
npm install --save-dev gulp-lqip-base64
const { task, src, dest } = require('gulp')
const lqipBase64 = require('gulp-lqip-base64')
task('default', () => {
return src('**/*.html', { base: '.' })
.pipe(lqipBase64({ attribute: 'srcset' }))
.pipe(dest('.'))
})
or you can
import lqipBase64 from 'gulp-lqip-base64'
Currently ['jpeg', 'jpg', 'png', 'bmp', 'tiff', 'gif']
are supported.
Type: Object
- Type:
String
- Default:
src
Attribute which contain the image path.
- Type:
String
- Default:
data-src
Attribute which will contain the Base64 representation of the image.
Thanks gulp-image-lqip for the inspiration.