icon.less
928 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@import "sprite";
//retina @2x
.sprite-width(@sprite) {
width: extract(@sprite, 5)/2;
}
.sprite-height(@sprite) {
height: extract(@sprite, 6)/2;
}
.sprite-position(@sprite) {
@sprite-offset-x: extract(@sprite, 3)/2;
@sprite-offset-y: extract(@sprite, 4)/2;
background-position: @sprite-offset-x @sprite-offset-y;
}
.sprite-background-size(@spritesheet-width) {
background-size: @spritesheet-width/2;
}
.sprite-image(@sprite) {
@sprite-image: extract(@sprite, 9);
@sprite-image-bare: ~`"@{sprite-image}".slice(1, -1)`;
background-image: url(@sprite-image-bare);
}
.sprite(@sprite) {
.sprite-image(@sprite);
.sprite-position(@sprite);
.sprite-width(@sprite);
.sprite-height(@sprite);
.sprite-background-size(@spritesheet-width);
}
//合并图
.m-icon {
display: inline-block;
vertical-align: middle;
}
.sprites(@spritesheet-sprites);
//自定义 非合并图