0.0.4 • Published 7 years ago

gulp-img-retina v0.0.4

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

gulp-img-retina

Build Status

add img attribute 'srcset' for retina

Prerequisites

You must have retina images in the folder which the original image in.

Install

npm install gulp-img-retina

Usage

var gulp = require('gulp');
var imgRetina = require('gulp-img-retina');

var retinaOpts = {
    // Your options here.
};

gulp.task('views', function() {

  return gulp.src('./views/**/*.html')
    .pipe(imgRetina(retinaOpts))
    .on('error', function(e) {
      console.log(e.message);
    })
    .pipe(gulp.dest('./build'));

});

You put html in:

<figure>
	<img src="images/default/example.jpg" alt="example image" />
</figure>

And get html out:

<figure>
	<img src="images/default/example.jpg" alt="example image" srcset="images/default/example.jpg 1x, images/default/example@2x.jpg 2x, images/default/example@3x.jpg 3x" />
</figure>

Options (Optional)

options.suffix

Type: Object

Default: {1: '', 2: '@2x', 3: '@3x'}

The suffix will insert to image's path, the key is resolution, and value is suffix.

0.0.4

7 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago