fis-spriter-csssprites
Advanced tools
Comparing version 0.1.9 to 0.2.2
@@ -20,4 +20,5 @@ /* | ||
'height_limit': 10240, | ||
'layout': 'linear' | ||
} | ||
'layout': 'linear', | ||
'ie_bug_fix': true | ||
}; | ||
@@ -95,4 +96,25 @@ | ||
this.ret.pkg[this.file.subpathNoExt + ext] = image_file; | ||
this.css += arr_selector.join(',') | ||
+ '{background-image: url(' + image_file.getUrl(this.opt.hash, this.opt.domain) + image_file.hash + ')}'; | ||
function unique(arr) { | ||
var map = {}; | ||
return arr.filter(function(item){ | ||
return map.hasOwnProperty(item) ? false : map[item] = true; | ||
}); | ||
} | ||
if (this.settings.ie_bug_fix) { | ||
var MAX = this.settings.max_selectores || 30; //max 36 | ||
var arr_selector = unique(arr_selector.join(',').split(',')); | ||
var len = arr_selector.length; | ||
var n = Math.ceil(len / MAX); | ||
for (var i = 0; i < n; i++) { | ||
var step = i * MAX | ||
this.css += arr_selector.slice(step, step + MAX).join(',') | ||
+ '{background-image: url(' + image_file.getUrl(this.opt.hash, this.opt.domain) + image_file.hash + ')}'; | ||
} | ||
} else { | ||
this.css += unique(arr_selector.join(',').split(',')).join(',') | ||
+ '{background-image: url(' + image_file.getUrl(this.opt.hash, this.opt.domain) + image_file.hash + ')}'; | ||
} | ||
}, | ||
@@ -99,0 +121,0 @@ z_pack: require('./pack.js'), |
{ | ||
"name": "fis-spriter-csssprites", | ||
"version": "0.1.9", | ||
"version": "0.2.2", | ||
"description": "基于fis的csssprite,支持repeat-x,repeat-x,background-position", | ||
@@ -17,3 +17,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"node-images": "1.5.5" | ||
"node-images": "1.5.5" | ||
}, | ||
@@ -20,0 +20,0 @@ "keywords": [ |
@@ -14,3 +14,3 @@ ## fis-spriter-csssprites | ||
0. 依赖native插件,[node-images](https://github.com/fex-team/node-images) 环境需要符合个插件的要求。(OS X、Windows、Linux x86 提供了二进制包) | ||
0. 依赖native插件,[node-images](https://github.com/xiangshouding/node-images) 环境需要符合个插件的要求。(OS X、Windows、Linux x86 提供了二进制包) | ||
0. 只能在FIS中使用 | ||
@@ -17,0 +17,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
29244
633
1