指南针:如何使用相同的文件夹名称引用不同的精灵? [英] Compass: How to reference to different sprites with identical folder names?

查看:61
本文介绍了指南针:如何使用相同的文件夹名称引用不同的精灵?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设在标准Compass项目的 img 文件夹中有2个Sprite文件夹。在每个文件夹中,我们还有另外两个名称相同的文件夹:

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

我们知道Compass使用最后一个文件夹名称来引用雪碧。但是,在这种情况下,一个人怎么可以叫他们每个人呢?

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?

推荐答案

不要使用魔法,请使用助手:

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");

有关更多信息,请参见此处: http://compass-style.org/reference/compass/helpers/sprites/

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

这篇关于指南针:如何使用相同的文件夹名称引用不同的精灵?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆