Socket
Socket
Sign inDemoInstall

coveo-png-sprite

Package Overview
Dependencies
295
Maintainers
7
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

47

gulp.js

@@ -1,10 +0,9 @@

var gutil = require('gulp-util');
var through = require('through2');
var Buffer = require('buffer').Buffer;
const Buffer = require('buffer').Buffer;
const Vinyl = require('vinyl');
const path = require('path');
const through = require('through2');
const stream = require('stream');
var Sprite = require("./index.js").Sprite;
const Sprite = require("./index.js").Sprite;
var path = require('path');
module.exports = function (opt) {

@@ -15,3 +14,3 @@ opt = opt || {};

var sprite = new Sprite(opt);
const sprite = new Sprite(opt);

@@ -27,14 +26,24 @@ function bufferImages(file, encoding, done) {

sprite.addFile(file, done);
if (file.isStream()) {
sprite.addFile(file, done);
} else if (file.isBuffer()) {
const bufferStream = new stream.PassThrough();
bufferStream.end(file.contents);
bufferStream.base = file.base;
bufferStream.path = file.path;
sprite.addFile(bufferStream, done);
}
}
function endStream(done) {
var relativePath = opt.relPath || path.relative(path.dirname(opt.cssPath), opt.pngPath);
var obj = sprite.compile(relativePath);
var self = this;
self.push(new gutil.File({
const relativePath = opt.relPath || path.relative(path.dirname(opt.cssPath), opt.pngPath);
const obj = sprite.compile(relativePath);
this.push(new Vinyl({
cwd: "/",
base: opt.base,
path: path.resolve(opt.base, opt.cssPath),
contents: new Buffer(obj.css)
contents: Buffer.from(obj.css)
}));

@@ -44,8 +53,6 @@

// just concat the buffer ftw
var buffers = [];
obj.png.on('data', function(chunk){
buffers.push(chunk);
});
obj.png.on('end', function(){
self.push(new gutil.File({
const buffers = [];
obj.png.on('data', (chunk) => buffers.push(chunk));
obj.png.on('end', () => {
this.push(new Vinyl({
cwd: "/",

@@ -52,0 +59,0 @@ base: opt.base,

@@ -1,8 +0,9 @@

var gulp = require('gulp');
var gulpSprite = require('./gulp');
gulp.task('default', function() {
gulp
const gulp = require('gulp');
const gulpSprite = require('./index').gulp;
gulp.task('default', () => {
return gulp
.src('test/img/**/*.png')
.pipe(gulpSprite())
.pipe(gulp.dest('target/'));
});
});

@@ -1,7 +0,7 @@

var PNG = require('node-pngjs').PNG,
path = require('path'),
ejs = require('ejs'),
fs = require('fs');
const PNG = require('pngjs').PNG;
const path = require('path');
const ejs = require('ejs');
const fs = require('fs');
var spriteOffset = 2;
const spriteOffset = 2;

@@ -128,8 +128,8 @@ function Sprite(opt) {

nodes.forEach(function (node) {
nodes.forEach((node) => {
// Format Name
node.className = ejs.render(self.opt.className, {
node.className = ejs.render(this.opt.className, {
path: path,
node: node,
namespace: self.opt.namespace
namespace: this.opt.namespace
});

@@ -136,0 +136,0 @@ node.image.bitblt(png, 0, 0, node.width, node.height, node.x, node.y);

{
"name": "coveo-png-sprite",
"version": "1.0.0",
"version": "1.0.1",
"description": "Gulp task that converts images to sprites+css",

@@ -28,9 +28,8 @@ "main": "index.js",

"dependencies": {
"ejs": "^2.5.6",
"gulp": "^3.8.10",
"gulp-util": "^3.0.1",
"node-pngjs": "0.0.3",
"through": "^2.3.6",
"through2": "^2.0.3"
"ejs": "2.6.1",
"gulp": "4.0.0",
"pngjs": "3.4.0",
"through2": "3.0.1",
"vinyl": "2.2.0"
}
}

@@ -1,5 +0,6 @@

var fs = require('fs');
const fs = require('fs');
var Sprite = require("../index.js").Sprite;
var sprite = new Sprite();
const Sprite = require("../index.js").Sprite;
const sprite = new Sprite();
sprite.addImageSrc([

@@ -11,5 +12,5 @@ "./test/img/red.png",

], function(){
var obj = sprite.compile('./sprite.png');
const obj = sprite.compile('./sprite.png');
obj.png.pipe(fs.createWriteStream('sprite.png'));
fs.writeFile('sprite.css', obj.css);
});
fs.writeFileSync('sprite.css', obj.css);
});
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc