New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

css-spritesmith

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-spritesmith - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

33

lib/css-spritesmith.js

@@ -49,5 +49,2 @@ // Deps

function filterNullFn(v) {
return !!v;
}

@@ -78,3 +75,3 @@ function fixPath(path) {

var id = createPlace.id++;
id = '@$sprite_place_'+ id +'$@';
id = '!$sprite_place_'+ id +'$!';

@@ -88,2 +85,24 @@ var pattern = new RegExp(escapeRegExp(id), 'g');

function filterNullFn(v) {
return !!v;
}
function uniqueCssSelectors(selectors) {
var str = selectors.filter(filterNullFn)
.join(',');
var selectorHash = {};
var retSelectors = [];
str.split(',').forEach(function(s) {
s = s.trim();
if(s && !selectorHash[s]) {
selectorHash[s] = true;
retSelectors.push(s);
}
});
return retSelectors;
}
function getBgPosCss(x, y, ratio) {

@@ -388,3 +407,3 @@ if(ratio && ratio > 1) {

var placeEscapeId = escapeRegExp(place.id);
var rselector = new RegExp('([^}\\n\\/]+)\\{[^\\}]*?' + placeEscapeId);
var rselector = new RegExp('([^}\\/!]+)\\{[^\\}]*?' + placeEscapeId);

@@ -463,3 +482,3 @@ var selector;

cssSelectors = cssSelectors.filter(filterNullFn);
cssSelectors = uniqueCssSelectors(cssSelectors);

@@ -487,3 +506,3 @@ var spriteImg = sliceData.spriteImg;

retinaCssProps = retinaCssProps.filter(filterNullFn);
retinaSelectors = retinaSelectors.filter(filterNullFn);
retinaSelectors = uniqueCssSelectors(retinaSelectors);

@@ -490,0 +509,0 @@ var retinaBgWidth = Math.floor(retinaSpriteData.properties.width / 2);

{
"name": "css-spritesmith",
"description": "A plugin to help front engineer creating css sprite.",
"version": "0.0.2",
"version": "0.0.3",
"homepage": "https://github.com/laoshu133/css-spritesmith",

@@ -6,0 +6,0 @@ "author": {

@@ -157,3 +157,5 @@ # css-spritesmith

`0.0.3` 修正多个选择器并列时丢失选择器 BUG
## 致谢

@@ -160,0 +162,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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