fis-spriter-csssprites
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -47,3 +47,3 @@ /* | ||
self._type = res[1]; | ||
self._position[0] = res[1]; | ||
self._position[0] = (res[1] == 'left') ? 0 : res[1]; | ||
} else { | ||
@@ -50,0 +50,0 @@ self._position[0] = parseFloat(res[1]); |
@@ -16,3 +16,21 @@ /* | ||
function Generator(file, list, ret, settings, opt) { | ||
settings.margin = settings.margin ? parseFloat(settings.margin) : '0'; | ||
var default_settings = { | ||
'margin': 3, | ||
'width_limit': 10240, | ||
'height_limit': 10240 | ||
} | ||
fis.util.map(default_settings, function (key, value) { | ||
if (settings.hasOwnProperty(key)) { | ||
if ((typeof value) == 'number') { | ||
settings[key] = parseFloat(settings[key]); | ||
} | ||
} else { | ||
settings[key] = value; | ||
} | ||
}); | ||
//设置宽高限制 | ||
Image.setLimit(settings.width_limit, settings.height_limit); | ||
this.file = file; | ||
@@ -47,3 +65,7 @@ this.ret = ret; | ||
&& this.ret.src[i].getUrl(this.opt.hash, this.opt.domain) == release) { | ||
return this.ret.src[i]; | ||
if (this.ret.src[i].release != false) { | ||
return this.ret.src[i]; | ||
} else { | ||
break; | ||
} | ||
} | ||
@@ -64,12 +86,4 @@ } | ||
var image_file = fis.file.wrap(this.file.realpathNoExt + ext); | ||
if (this.opt.optimize) { | ||
var compress_conf = fis.config.get('settings.optimizer.pngquant') || {}; | ||
image_file.setContent( | ||
Pngquant.option(compress_conf) | ||
.compress(image.encode('png')) | ||
); | ||
} else { | ||
image_file.setContent(image.encode('png')); | ||
} | ||
image_file.compiled = true; | ||
image_file.setContent(image.encode('png')); | ||
fis.compile(image_file); | ||
this.ret.pkg[this.file.subpathNoExt + ext] = image_file; | ||
@@ -279,4 +293,2 @@ this.css += arr_selector.join(',') | ||
x_cur = 'right '; | ||
} else if (current.cls[j].position[0] == 'left') { | ||
x_cur = -x + 'px '; | ||
} else { | ||
@@ -283,0 +295,0 @@ x_cur = (-x + current.cls[j].position[0]) + 'px '; |
{ | ||
"name": "fis-spriter-csssprites", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "基于fis的csssprite,支持repeat-x,repeat-x,background-position", | ||
@@ -17,4 +17,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"node-images": "1.5.2", | ||
"node-pngquant-native": "0.0.3" | ||
"node-images": "1.5.2" | ||
}, | ||
@@ -21,0 +20,0 @@ "keywords": [ |
@@ -11,3 +11,3 @@ ##fis-spriter-csssprites | ||
####环境要求 | ||
0. 依赖两个native插件,[node-pngquant-native](https://github.com/xiangshouding/node-pngquant-native), [node-images](https://github.com/xiangshouding/node-images) 环境需要符合这两个插件的要求。 | ||
0. 依赖native插件,[node-images](https://github.com/xiangshouding/node-images) 环境需要符合这两个插件的要求。 | ||
0. 只能在FIS中使用 | ||
@@ -14,0 +14,0 @@ |
25131
1
570
- Removednode-pngquant-native@0.0.3
- Removednode-pngquant-native@0.0.3(transitive)