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

assetgraph-sprite

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assetgraph-sprite - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

43

lib/spriteBackgroundImages.js

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

var queryString = require('querystring'),
var URL = require('url'),
queryString = require('querystring'),
_ = require('underscore'),
seq = require('seq'),
passError = require('passerror'),
AssetGraph = require('assetgraph'),
urlTools = require('assetgraph/lib/util/urlTools'),
packers = require('./packers'),

@@ -32,6 +31,6 @@ Canvas;

function getImageAssetFromCanvas(canvas, assetType, cb) {
function getImageAssetFromCanvas(canvas, assetType, assetGraph, cb) {
if (assetType === 'Png') {
canvas.toBuffer(passError(cb, function (pngBuffer) {
cb(null, new AssetGraph.Png({
cb(null, new assetGraph.Png({
rawSrc: pngBuffer

@@ -45,3 +44,3 @@ }));

}).on('end', function () {
cb(null, new AssetGraph.Jpeg({
cb(null, new assetGraph.Jpeg({
rawSrc: Buffer.concat(jpegChunks)

@@ -98,3 +97,3 @@ }));

return info;
};
}

@@ -110,3 +109,5 @@

// Waiting for https://github.com/LearnBoost/node-canvas/issues/52
var cairoVersion = Canvas.cairoVersion.split(".").map(function (str) {return parseInt(str, 10);});
var cairoVersion = Canvas.cairoVersion.split(".").map(function (str) {
return parseInt(str, 10);
});
if (cairoVersion[0] < 1 || cairoVersion[1] < 10) {

@@ -130,3 +131,3 @@ console.warn("assetgraph-sprite: Cannot create sprites due to missing canvas.getContext('2d').drawImage() support. Please compile node-canvas with Cairo version 1.10.0 or above.");

for (var i = 0 ; i < 4 ; i += 1) {
imageInfo.padding[i] = Math.max(padding[i], imageInfo.padding[i]);
imageInfo.padding[i] = Math.max(relationSpriteInfo.padding[i], imageInfo.padding[i]);
}

@@ -199,3 +200,3 @@ }

});
getImageAssetFromCanvas(canvas, /^jpe?g$/.test(spriteInfo.imageFormat) ? 'Jpeg' : 'Png', this);
getImageAssetFromCanvas(canvas, /^jpe?g$/.test(spriteInfo.imageFormat) ? 'Jpeg' : 'Png', assetGraph, this);
})

@@ -218,7 +219,7 @@ .seq(function (spriteAsset) {

}
spriteAsset.url = urlTools.resolveUrl(baseUrl, href);
spriteAsset.url = URL.resolve(baseUrl, href);
assetGraph.addAsset(spriteAsset);
if (spriteGroup.placeHolder) {
var cssRule = spriteGroup.placeHolder.cssRule,
relation = new AssetGraph.CssImage({
relation = new assetGraph.CssImage({
cssRule: cssRule,

@@ -257,3 +258,3 @@ from: spriteGroup.placeHolder.asset,

['selector-for-group', 'packer', 'image-format', 'background-color', 'important'].forEach(function (propertyName) {
spriteGroup.placeHolder.cssRule.style.removeProperty('-sprite-' + propertyName);
spriteGroup.placeHolder.cssRule.style.removeProperty('-sprite-' + propertyName);
});

@@ -296,7 +297,5 @@ }

style.setProperty('background-position',
offsets.map(function (item) {
return item ? -item + 'px' : '0';
}).join(' '),
backgroundPositionPriority);
style.setProperty('background-position', offsets.map(function (item) {
return item ? -item + 'px' : '0';
}).join(' '), backgroundPositionPriority);
['group', 'padding', 'no-group-selector', 'important'].forEach(function (propertyName) {

@@ -309,3 +308,3 @@ style.removeProperty('-sprite-' + propertyName);

// matched by the sprite group's "main" selector, which would have been preferable.
var relation = new AssetGraph.CssImage({
var relation = new assetGraph.CssImage({
cssRule: incomingRelation.cssRule,

@@ -330,10 +329,8 @@ propertyName: incomingRelation.propertyName,

callback();
})
['catch'](callback);
})['catch'](callback);
})
.seq(function () {
cb();
})
['catch'](cb);
})['catch'](cb);
};
};

@@ -5,3 +5,3 @@ {

"repository": "git://github.com/One-com/assetgraph-sprite.git",
"version": "0.5.0",
"version": "0.5.1",
"maintainers": [

@@ -26,3 +26,3 @@ {

"devDependencies": {
"assetgraph": "latest",
"assetgraph": "=1.2.3",
"vows": ">=0.6.2"

@@ -29,0 +29,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