项目作者: Johann-S

项目描述 :
Gulp plugin which generates HTML image placeholders using lqip technique
高级语言: JavaScript
项目地址: git://github.com/Johann-S/gulp-image-lqip.git
创建时间: 2019-06-06T12:15:23Z
项目社区:https://github.com/Johann-S/gulp-image-lqip

开源协议:MIT License

下载


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

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

Usage

  1. const gulp = require('gulp');
  2. const gulpImgLqip = require('gulp-image-lqip');
  3. gulp.task('default', () => {
  4. return gulp.src('*.html')
  5. // `gulp-image-lqip` needs filepaths
  6. // so you can't have any plugins before it
  7. .pipe(gulpImgLqip(__dirname))
  8. })

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 :+1:

License

MIT © Johann-S