Parses your HTML files to find images and adds a data-src attribute to them which contains their Base64 representation.
npm install --save-dev gulp-image-lqip
const gulp = require('gulp');
const gulpImgLqip = require('gulp-image-lqip');
gulp.task('default', () => {
return gulp.src('*.html')
// `gulp-image-lqip` needs filepaths
// so you can't have any plugins before it
.pipe(gulpImgLqip(__dirname))
})
Currently ['jpeg', 'jpg', 'png', 'gif']
files are supported.
- Type:
string
- Required
Define the rootPath of your website, it must be an absolute path.
Type: Object
- Type:
string
- Default:
data-src
Attribute which will contain the Base64 representation of your image.
- Type:
Boolean
- Default:
true
Use pretty to beautify the HTML files.
- Type:
string
- Default:
src
Attribute which contain your image.
If you want to thank me or support my work:
Thanks lqip for the inspiration 👍
MIT © Johann-S