Compass: How to reference to different sprites with identical folder names?

烈酒焚心 提交于 2019-12-08 05:45:28

问题


Suppose we have 2 sprite folders inside the img folder of a standard Compass project. Inside each one of them, we have other 2 folders with identical names:

project/img/chapter1/icons
project/img/chapter2/icons

We know Compass uses the last folder name so as to reference to the sprite. But, in this case, how could one call each one of them?


回答1:


Don't use the magic, use the helpers:

$icons1-sprite: sprite-map("project/img/chapter1/icons/*.png");
$icons2-sprite: sprite-map("project/img/chapter2/icons/*.png");

See here for more: http://compass-style.org/reference/compass/helpers/sprites/



来源:https://stackoverflow.com/questions/12727643/compass-how-to-reference-to-different-sprites-with-identical-folder-names

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!