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.4.0 to 0.5.0

27

lib/spriteBackgroundImages.js

@@ -35,3 +35,3 @@ var queryString = require('querystring'),

canvas.toBuffer(passError(cb, function (pngBuffer) {
cb(null, new AssetGraph.assets.Png({
cb(null, new AssetGraph.Png({
rawSrc: pngBuffer

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

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

@@ -86,2 +86,17 @@ }));

function extractInfoFromCssRule(cssRule, propertyNamePrefix) {
var info = {};
for (var i = 0 ; i < cssRule.style.length ; i += 1) {
var propertyName = cssRule.style[i];
if (!propertyNamePrefix || propertyName.indexOf(propertyNamePrefix) === 0) {
var keyName = propertyName.substr(propertyNamePrefix.length).replace(/-([a-z])/g, function ($0, $1) {
return $1.toUpperCase();
});
info[keyName] = cssRule.style[propertyName].replace(/^([\'\"])(.*)\1$/, "$2");
}
}
return info;
};
module.exports = function () {

@@ -120,3 +135,3 @@ return function spriteBackgroundImages(assetGraph, cb) {

assetGraph.findAssets({type: 'Css'}).forEach(function (cssAsset) {
AssetGraph.assets.Css.eachRuleInParseTree(cssAsset.parseTree, function (cssRule) {
cssAsset.eachRuleInParseTree(function (cssRule) {
if (cssRule.type !== 1) { // cssom.CSSRule.STYLE_RULE

@@ -126,3 +141,3 @@ return;

if (('-sprite-selector-for-group') in cssRule.style) {
var spriteInfo = AssetGraph.assets.Css.extractInfoFromRule(cssRule, '-sprite-'),
var spriteInfo = extractInfoFromCssRule(cssRule, '-sprite-'),
spriteGroupName = spriteInfo.selectorForGroup;

@@ -206,3 +221,3 @@ if ('location' in spriteInfo) {

var cssRule = spriteGroup.placeHolder.cssRule,
relation = new AssetGraph.relations.CssImage({
relation = new AssetGraph.CssImage({
cssRule: cssRule,

@@ -291,3 +306,3 @@ from: spriteGroup.placeHolder.asset,

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

@@ -294,0 +309,0 @@ propertyName: incomingRelation.propertyName,

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

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

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