Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-retina-resizer

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-retina-resizer - npm Package Compare versions

Comparing version 0.1.1 to 0.2.0

21

index.js

@@ -19,6 +19,7 @@ 'use strict';

};
const COPY = Boolean(arg && arg.copy);
return through.obj(function(file, encoding, cb) {
if(file.isNull() || file.isDirectory()) {
return cb();
if(!file.isBuffer()) {
return cb(null, file);
}

@@ -41,2 +42,6 @@

let getName = function(path, to) {
return /[\\\/]+([^\\\/@]+)(@\dx)?\.[^\.\\\/]+$/.exec(path)[1] + '@' + to + 'x.png';
};
let makePromise = function(info, to) {

@@ -49,3 +54,3 @@ let size = info.size;

let path = info.path;
let name = /[\\\/]+([^\\\/]+)\.[^\.\\\/]+$/.exec(path)[1] + '@' + to + 'x.png';
let name = getName(path, to);

@@ -72,5 +77,13 @@ return new Promise(function(resolve, reject) {

})
.then(() => cb())
.then(function() {
if(COPY) {
createFile({
name: getName(file.path, BASE),
buffer: file.contents
});
}
return cb();
})
.catch(err => this.emit('error', err));
});
};

2

package.json
{
"name": "gulp-retina-resizer",
"version": "0.1.1",
"version": "0.2.0",
"description": "resize images",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,4 +19,5 @@ 本插件用于在 Gulp 中转换图片大小,可从3倍图转换到2倍或1倍,也可从2倍转到1倍。

.pipe(resizer({
base: 2,
to: 1
base: 3,
to: [1, 2],
copy: true
}))

@@ -35,3 +36,4 @@ .pipe(gulp.dest('dest'))

base: 2,
to: 1
to: 1,
copy: false
}

@@ -42,2 +44,3 @@ ```

- `to`:数字或数组,生成图的倍数比
- `copy`: 布尔值,是否复制原图到目的文件夹

@@ -44,0 +47,0 @@ 计算方式:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc