Gulp plugin which generates HTML image placeholders using lqip technique
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.
string
Define the rootPath of your website, it must be an absolute path.
Type: Object
string
data-src
Attribute which will contain the Base64 representation of your image.
Boolean
true
Use pretty to beautify the HTML files.
string
src
Attribute which contain your image.
If you want to thank me or support my work:
Thanks lqip for the inspiration
MIT © Johann-S