gulp-image-lqip

2.0.0 • Public • Published

gulp-image-lqip

npm version Build Status dependencies Status devDependency Status

Parses your HTML files to find images and adds a data-src attribute to them which contains their Base64 representation.

Demo

Install

npm install --save-dev gulp-image-lqip

Usage

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))
})

Supported files

Currently ['jpeg', 'jpg', 'png', 'gif'] files are supported.

API

gulpImgLqip(rootPath, options)

rootPath

  • Type: string
  • Required

Define the rootPath of your website, it must be an absolute path.

options

Type: Object

attribute
  • Type: string
  • Default: data-src

Attribute which will contain the Base64 representation of your image.

pretty
  • Type: Boolean
  • Default: true

Use pretty to beautify the HTML files.

srcAttr
  • Type: string
  • Default: src

Attribute which contain your image.

Support me

If you want to thank me or support my work:

Thanks

Thanks lqip for the inspiration 👍

License

MIT © Johann-S

Package Sidebar

Install

npm i gulp-image-lqip

Weekly Downloads

0

Version

2.0.0

License

MIT

Unpacked Size

7.9 kB

Total Files

6

Last publish

Collaborators

  • johann-s