Socket
Book a DemoInstallSign in
Socket

gulp-responsive-imgz

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-responsive-imgz

add img attribute 'srcset' for retina

0.0.5
latest
Source
npmnpm
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

gulp-responsive-imgz

(clone of the innactive gulp-img-retina repo)

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-responsive-imgz

Usage

var gulp = require('gulp');
var imgRetina = require('gulp-responsive-imgz');

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

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

Note

SVG's are ignored

Keywords

retina

FAQs

Package last updated on 26 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.