cssgrace
Advanced tools
Comparing version 2.0.1 to 2.0.2
# CSS Grace | ||
## V 2.0.2 (2015-03-25) | ||
\* Fix the image-set() does not support background shorthand. | ||
## V 2.0.1 (2015-03-23) | ||
@@ -4,0 +8,0 @@ |
@@ -11,2 +11,3 @@ var path = require('path'), | ||
var reURL = /url\s*\(\s*(['"]?)([^\)'"]+)\1\s*\)\s+(\dx)/gi; | ||
var reIMAGE_SET = /-webkit-image-set\(\s*,\s*\)/gi; | ||
var reALL_PSEUDO = /::(before|after|first-line|first-letter)/gi; | ||
@@ -356,2 +357,3 @@ var reNO_SETURL = /url\(\s*(['"]?)([^\)'"]+)\1\s*\)/gi; | ||
obj.path = "url(" + obj.url + ")"; | ||
var fullPath = decl.value.replace(reURL, '').replace(reIMAGE_SET, obj.path); | ||
obj.whichImg = paths[j][3]; | ||
@@ -367,6 +369,14 @@ if (obj.whichImg == "1x" || obj.whichImg == "1x") { | ||
decl.parent.insertBefore(i, { | ||
prop: 'background-image', | ||
value: obj.path | ||
}); | ||
if (decl.prop == 'background') { | ||
decl.parent.insertBefore(i, { | ||
prop: 'background', | ||
value: fullPath | ||
}); | ||
} else if (decl.prop == 'background-image') { | ||
decl.parent.insertBefore(i, { | ||
prop: 'background-image', | ||
value: obj.path | ||
}); | ||
} | ||
} else if (obj.whichImg == "2x" || obj.whichImg == "2x") { | ||
@@ -380,10 +390,4 @@ var rSizes = sizeOf(getAbsolutePath(obj.url)); //2倍图尺寸 | ||
atRuleObj.name = "media"; | ||
var newParams = [ | ||
'\n only screen and (-o-min-device-pixel-ratio: 2/1)', | ||
'\n only screen and (min--moz-device-pixel-ratio: 2)', | ||
'\n only screen and (-moz-min-device-pixel-ratio: 2)', | ||
'\n only screen and (-webkit-min-device-pixel-ratio: 2)', | ||
'\n only screen and (min-resolution: 192dpi)', | ||
'\n only screen and (min-resolution: 2dppx)' | ||
]; | ||
//其他前缀交给 Autoprefixer 处理 | ||
var newParams = 'only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx)'; | ||
@@ -394,7 +398,7 @@ var atRule = postcss.atRule({ | ||
}); | ||
// var atBefore = decl.parent.before; | ||
var nextrule = postcss.rule({ | ||
selector: decl.parent.selector, | ||
after: decl.parent.after | ||
// before: atBefore | ||
after: decl.parent.after, | ||
before: '\n ' | ||
}); | ||
@@ -401,0 +405,0 @@ //插入 @规则 中的选择器 |
{ | ||
"name": "cssgrace", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "CSS postproccessor", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -304,9 +304,4 @@ | ||
} | ||
@media | ||
only screen and (-o-min-device-pixel-ratio: 2/1), | ||
only screen and (min--moz-device-pixel-ratio: 2), | ||
only screen and (-moz-min-device-pixel-ratio: 2), | ||
only screen and (-webkit-min-device-pixel-ratio: 2), | ||
only screen and (min-resolution: 192dpi), | ||
only screen and (min-resolution: 2dppx) { | ||
@media only screen and (min-resolution: 2dppx) { | ||
.foo { | ||
@@ -313,0 +308,0 @@ background-image: url(../img/yuxifan@2x.jpg); |
@@ -220,9 +220,4 @@ | ||
} | ||
@media | ||
only screen and (-o-min-device-pixel-ratio: 2/1), | ||
only screen and (min--moz-device-pixel-ratio: 2), | ||
only screen and (-moz-min-device-pixel-ratio: 2), | ||
only screen and (-webkit-min-device-pixel-ratio: 2), | ||
only screen and (min-resolution: 192dpi), | ||
only screen and (min-resolution: 2dppx) { | ||
@media only screen and (min-resolution: 2dppx) { | ||
.foo { | ||
@@ -229,0 +224,0 @@ background-image: url(../img/yuxifan@2x.jpg); |
455
35791
558