laoshu133 / grunt-css-sprite

A grunt plugin to help front engineer creating css sprite.
MIT License
65 stars 29 forks source link

新版 (>=0.0.9) Window 中, 路径分隔符替换问题 #11

Closed 17 closed 10 years ago

17 commented 10 years ago

在 Window 中 路径会被替换成 ..\img\main.png 并不是 ../img/main.png. 这样会导致浏览器 URL 识别错误.

xuexb commented 10 years ago

+1, 且如果图片的路径后面有 ? 那么这个图片将不会被匹配, 如:

.mod-form .item-4:hover .icons{background-image:url('../../images/home/index/job-sprite/1-4.png?x');}
.mod-form .item-5:hover .icons{background-image:url('../../images/home/index/job-sprite/1-5.png?x');}
.mod-form .item-6:hover .icons{background-image:url('../../images/home/index/job-sprite/1-6.png');}

=>

.mod-form .item-4:hover .icons{background-image:url('../../images/home/index/job-sprite/1-4.png?x');}
.mod-form .item-5:hover .icons{background-image:url('../../images/home/index/job-sprite/1-5.png?x');}
.mod-form .item-6:hover .icons{background-image:url('..\..\images\home\index\index.png?20140627150655');background-position:-72px -72px;}
laoshu133 commented 10 years ago

5045650f98969a9f844c750226433f0cd8c6f0cb

路径问题已经修正, 由于 grunt-css-sprite 自身会带有自动加入时间戳功能,内部采用路径替换,当原路径中带有 ? 不会进入匹配;建议不要在图标路径中带有 ?

PS. 为这次更新测试不完善带来的使用不愉快,表示歉意 :D