sp-sprite.less
14.2 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
/*
LESS variables are information about icon's compiled state, stored under its original file name
.icon-home {
width: @icon-home-width;
}
The large array-like variables contain all information about a single icon
@icon-home: x y offset_x offset_y width height total_width total_height image_path name;
At the bottom of this section, we provide information about the spritesheet itself
@spritesheet: width height image @spritesheet-sprites;
*/
@icon-copper-mini-name: 'icon-copper-mini';
@icon-copper-mini-x: 228px;
@icon-copper-mini-y: 162px;
@icon-copper-mini-offset-x: -228px;
@icon-copper-mini-offset-y: -162px;
@icon-copper-mini-width: 20px;
@icon-copper-mini-height: 20px;
@icon-copper-mini-total-width: 325px;
@icon-copper-mini-total-height: 288px;
@icon-copper-mini-image: '../images/2.3.0/dist/sprite.png';
@icon-copper-mini: 228px 162px -228px -162px 20px 20px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-copper-mini';
@icon-gold-mini-name: 'icon-gold-mini';
@icon-gold-mini-x: 228px;
@icon-gold-mini-y: 86px;
@icon-gold-mini-offset-x: -228px;
@icon-gold-mini-offset-y: -86px;
@icon-gold-mini-width: 20px;
@icon-gold-mini-height: 20px;
@icon-gold-mini-total-width: 325px;
@icon-gold-mini-total-height: 288px;
@icon-gold-mini-image: '../images/2.3.0/dist/sprite.png';
@icon-gold-mini: 228px 86px -228px -86px 20px 20px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-gold-mini';
@icon-gold-seller-name: 'icon-gold-seller';
@icon-gold-seller-x: 171px;
@icon-gold-seller-y: 238px;
@icon-gold-seller-offset-x: -171px;
@icon-gold-seller-offset-y: -238px;
@icon-gold-seller-width: 67px;
@icon-gold-seller-height: 16px;
@icon-gold-seller-total-width: 325px;
@icon-gold-seller-total-height: 288px;
@icon-gold-seller-image: '../images/2.3.0/dist/sprite.png';
@icon-gold-seller: 171px 238px -171px -238px 67px 16px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-gold-seller';
@icon-home-mini-name: 'icon-home-mini';
@icon-home-mini-x: 228px;
@icon-home-mini-y: 112px;
@icon-home-mini-offset-x: -228px;
@icon-home-mini-offset-y: -112px;
@icon-home-mini-width: 20px;
@icon-home-mini-height: 20px;
@icon-home-mini-total-width: 325px;
@icon-home-mini-total-height: 288px;
@icon-home-mini-image: '../images/2.3.0/dist/sprite.png';
@icon-home-mini: 228px 112px -228px -112px 20px 20px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-home-mini';
@icon-icon-abletrunk-name: 'icon-icon-abletrunk';
@icon-icon-abletrunk-x: 0px;
@icon-icon-abletrunk-y: 162px;
@icon-icon-abletrunk-offset-x: 0px;
@icon-icon-abletrunk-offset-y: -162px;
@icon-icon-abletrunk-width: 70px;
@icon-icon-abletrunk-height: 70px;
@icon-icon-abletrunk-total-width: 325px;
@icon-icon-abletrunk-total-height: 288px;
@icon-icon-abletrunk-image: '../images/2.3.0/dist/sprite.png';
@icon-icon-abletrunk: 0px 162px 0px -162px 70px 70px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-icon-abletrunk';
@icon-icon-check-name: 'icon-icon-check';
@icon-icon-check-x: 255px;
@icon-icon-check-y: 76px;
@icon-icon-check-offset-x: -255px;
@icon-icon-check-offset-y: -76px;
@icon-icon-check-width: 70px;
@icon-icon-check-height: 70px;
@icon-icon-check-total-width: 325px;
@icon-icon-check-total-height: 288px;
@icon-icon-check-image: '../images/2.3.0/dist/sprite.png';
@icon-icon-check: 255px 76px -255px -76px 70px 70px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-icon-check';
@icon-icon-discheck-name: 'icon-icon-discheck';
@icon-icon-discheck-x: 0px;
@icon-icon-discheck-y: 86px;
@icon-icon-discheck-offset-x: 0px;
@icon-icon-discheck-offset-y: -86px;
@icon-icon-discheck-width: 70px;
@icon-icon-discheck-height: 70px;
@icon-icon-discheck-total-width: 325px;
@icon-icon-discheck-total-height: 288px;
@icon-icon-discheck-image: '../images/2.3.0/dist/sprite.png';
@icon-icon-discheck: 0px 86px 0px -86px 70px 70px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-icon-discheck';
@icon-icon-disgather-name: 'icon-icon-disgather';
@icon-icon-disgather-x: 76px;
@icon-icon-disgather-y: 86px;
@icon-icon-disgather-offset-x: -76px;
@icon-icon-disgather-offset-y: -86px;
@icon-icon-disgather-width: 70px;
@icon-icon-disgather-height: 70px;
@icon-icon-disgather-total-width: 325px;
@icon-icon-disgather-total-height: 288px;
@icon-icon-disgather-image: '../images/2.3.0/dist/sprite.png';
@icon-icon-disgather: 76px 86px -76px -86px 70px 70px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-icon-disgather';
@icon-icon-disshopcart-name: 'icon-icon-disshopcart';
@icon-icon-disshopcart-x: 152px;
@icon-icon-disshopcart-y: 86px;
@icon-icon-disshopcart-offset-x: -152px;
@icon-icon-disshopcart-offset-y: -86px;
@icon-icon-disshopcart-width: 70px;
@icon-icon-disshopcart-height: 70px;
@icon-icon-disshopcart-total-width: 325px;
@icon-icon-disshopcart-total-height: 288px;
@icon-icon-disshopcart-image: '../images/2.3.0/dist/sprite.png';
@icon-icon-disshopcart: 152px 86px -152px -86px 70px 70px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-icon-disshopcart';
@icon-icon-gather-name: 'icon-icon-gather';
@icon-icon-gather-x: 76px;
@icon-icon-gather-y: 162px;
@icon-icon-gather-offset-x: -76px;
@icon-icon-gather-offset-y: -162px;
@icon-icon-gather-width: 70px;
@icon-icon-gather-height: 70px;
@icon-icon-gather-total-width: 325px;
@icon-icon-gather-total-height: 288px;
@icon-icon-gather-image: '../images/2.3.0/dist/sprite.png';
@icon-icon-gather: 76px 162px -76px -162px 70px 70px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-icon-gather';
@icon-icon-label-name: 'icon-icon-label';
@icon-icon-label-x: 255px;
@icon-icon-label-y: 152px;
@icon-icon-label-offset-x: -255px;
@icon-icon-label-offset-y: -152px;
@icon-icon-label-width: 61px;
@icon-icon-label-height: 60px;
@icon-icon-label-total-width: 325px;
@icon-icon-label-total-height: 288px;
@icon-icon-label-image: '../images/2.3.0/dist/sprite.png';
@icon-icon-label: 255px 152px -255px -152px 61px 60px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-icon-label';
@icon-icon-shopcart-name: 'icon-icon-shopcart';
@icon-icon-shopcart-x: 152px;
@icon-icon-shopcart-y: 162px;
@icon-icon-shopcart-offset-x: -152px;
@icon-icon-shopcart-offset-y: -162px;
@icon-icon-shopcart-width: 70px;
@icon-icon-shopcart-height: 70px;
@icon-icon-shopcart-total-width: 325px;
@icon-icon-shopcart-total-height: 288px;
@icon-icon-shopcart-image: '../images/2.3.0/dist/sprite.png';
@icon-icon-shopcart: 152px 162px -152px -162px 70px 70px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-icon-shopcart';
@icon-icon-trunk-name: 'icon-icon-trunk';
@icon-icon-trunk-x: 255px;
@icon-icon-trunk-y: 0px;
@icon-icon-trunk-offset-x: -255px;
@icon-icon-trunk-offset-y: 0px;
@icon-icon-trunk-width: 70px;
@icon-icon-trunk-height: 70px;
@icon-icon-trunk-total-width: 325px;
@icon-icon-trunk-total-height: 288px;
@icon-icon-trunk-image: '../images/2.3.0/dist/sprite.png';
@icon-icon-trunk: 255px 0px -255px 0px 70px 70px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-icon-trunk';
@icon-invalid-mini-name: 'icon-invalid-mini';
@icon-invalid-mini-x: 26px;
@icon-invalid-mini-y: 268px;
@icon-invalid-mini-offset-x: -26px;
@icon-invalid-mini-offset-y: -268px;
@icon-invalid-mini-width: 20px;
@icon-invalid-mini-height: 20px;
@icon-invalid-mini-total-width: 325px;
@icon-invalid-mini-total-height: 288px;
@icon-invalid-mini-image: '../images/2.3.0/dist/sprite.png';
@icon-invalid-mini: 26px 268px -26px -268px 20px 20px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-invalid-mini';
@icon-menu-name: 'icon-menu';
@icon-menu-x: 228px;
@icon-menu-y: 214px;
@icon-menu-offset-x: -228px;
@icon-menu-offset-y: -214px;
@icon-menu-width: 16px;
@icon-menu-height: 15px;
@icon-menu-total-width: 325px;
@icon-menu-total-height: 288px;
@icon-menu-image: '../images/2.3.0/dist/sprite.png';
@icon-menu: 228px 214px -228px -214px 16px 15px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-menu';
@icon-no1-name: 'icon-no1';
@icon-no1-x: 0px;
@icon-no1-y: 0px;
@icon-no1-offset-x: 0px;
@icon-no1-offset-y: 0px;
@icon-no1-width: 79px;
@icon-no1-height: 80px;
@icon-no1-total-width: 325px;
@icon-no1-total-height: 288px;
@icon-no1-image: '../images/2.3.0/dist/sprite.png';
@icon-no1: 0px 0px 0px 0px 79px 80px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-no1';
@icon-no2-name: 'icon-no2';
@icon-no2-x: 170px;
@icon-no2-y: 0px;
@icon-no2-offset-x: -170px;
@icon-no2-offset-y: 0px;
@icon-no2-width: 79px;
@icon-no2-height: 80px;
@icon-no2-total-width: 325px;
@icon-no2-total-height: 288px;
@icon-no2-image: '../images/2.3.0/dist/sprite.png';
@icon-no2: 170px 0px -170px 0px 79px 80px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-no2';
@icon-no3-name: 'icon-no3';
@icon-no3-x: 85px;
@icon-no3-y: 0px;
@icon-no3-offset-x: -85px;
@icon-no3-offset-y: 0px;
@icon-no3-width: 79px;
@icon-no3-height: 80px;
@icon-no3-total-width: 325px;
@icon-no3-total-height: 288px;
@icon-no3-image: '../images/2.3.0/dist/sprite.png';
@icon-no3: 85px 0px -85px 0px 79px 80px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-no3';
@icon-people-name: 'icon-people';
@icon-people-x: 228px;
@icon-people-y: 138px;
@icon-people-offset-x: -228px;
@icon-people-offset-y: -138px;
@icon-people-width: 16px;
@icon-people-height: 16px;
@icon-people-total-width: 325px;
@icon-people-total-height: 288px;
@icon-people-image: '../images/2.3.0/dist/sprite.png';
@icon-people: 228px 138px -228px -138px 16px 16px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-people';
@icon-plus-name: 'icon-plus';
@icon-plus-x: 255px;
@icon-plus-y: 218px;
@icon-plus-offset-x: -255px;
@icon-plus-offset-y: -218px;
@icon-plus-width: 12px;
@icon-plus-height: 12px;
@icon-plus-total-width: 325px;
@icon-plus-total-height: 288px;
@icon-plus-image: '../images/2.3.0/dist/sprite.png';
@icon-plus: 255px 218px -255px -218px 12px 12px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-plus';
@icon-real-name-mini-name: 'icon-real-name-mini';
@icon-real-name-mini-x: 0px;
@icon-real-name-mini-y: 268px;
@icon-real-name-mini-offset-x: 0px;
@icon-real-name-mini-offset-y: -268px;
@icon-real-name-mini-width: 20px;
@icon-real-name-mini-height: 20px;
@icon-real-name-mini-total-width: 325px;
@icon-real-name-mini-total-height: 288px;
@icon-real-name-mini-image: '../images/2.3.0/dist/sprite.png';
@icon-real-name-mini: 0px 268px 0px -268px 20px 20px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-real-name-mini';
@icon-sliver-mini-name: 'icon-sliver-mini';
@icon-sliver-mini-x: 228px;
@icon-sliver-mini-y: 188px;
@icon-sliver-mini-offset-x: -228px;
@icon-sliver-mini-offset-y: -188px;
@icon-sliver-mini-width: 20px;
@icon-sliver-mini-height: 20px;
@icon-sliver-mini-total-width: 325px;
@icon-sliver-mini-total-height: 288px;
@icon-sliver-mini-image: '../images/2.3.0/dist/sprite.png';
@icon-sliver-mini: 228px 188px -228px -188px 20px 20px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-sliver-mini';
@icon-talk-name: 'icon-talk';
@icon-talk-x: 0px;
@icon-talk-y: 238px;
@icon-talk-offset-x: 0px;
@icon-talk-offset-y: -238px;
@icon-talk-width: 92px;
@icon-talk-height: 24px;
@icon-talk-total-width: 325px;
@icon-talk-total-height: 288px;
@icon-talk-image: '../images/2.3.0/dist/sprite.png';
@icon-talk: 0px 238px 0px -238px 92px 24px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-talk';
@icon-tip-angle-name: 'icon-tip-angle';
@icon-tip-angle-x: 273px;
@icon-tip-angle-y: 218px;
@icon-tip-angle-offset-x: -273px;
@icon-tip-angle-offset-y: -218px;
@icon-tip-angle-width: 6px;
@icon-tip-angle-height: 7px;
@icon-tip-angle-total-width: 325px;
@icon-tip-angle-total-height: 288px;
@icon-tip-angle-image: '../images/2.3.0/dist/sprite.png';
@icon-tip-angle: 273px 218px -273px -218px 6px 7px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-tip-angle';
@icon-wl-real-location-name: 'icon-wl-real-location';
@icon-wl-real-location-x: 98px;
@icon-wl-real-location-y: 238px;
@icon-wl-real-location-offset-x: -98px;
@icon-wl-real-location-offset-y: -238px;
@icon-wl-real-location-width: 67px;
@icon-wl-real-location-height: 16px;
@icon-wl-real-location-total-width: 325px;
@icon-wl-real-location-total-height: 288px;
@icon-wl-real-location-image: '../images/2.3.0/dist/sprite.png';
@icon-wl-real-location: 98px 238px -98px -238px 67px 16px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-wl-real-location';
@icon-wl-real-name-name: 'icon-wl-real-name';
@icon-wl-real-name-x: 244px;
@icon-wl-real-name-y: 238px;
@icon-wl-real-name-offset-x: -244px;
@icon-wl-real-name-offset-y: -238px;
@icon-wl-real-name-width: 67px;
@icon-wl-real-name-height: 16px;
@icon-wl-real-name-total-width: 325px;
@icon-wl-real-name-total-height: 288px;
@icon-wl-real-name-image: '../images/2.3.0/dist/sprite.png';
@icon-wl-real-name: 244px 238px -244px -238px 67px 16px 325px 288px '../images/2.3.0/dist/sprite.png' 'icon-wl-real-name';
@spritesheet-width: 325px;
@spritesheet-height: 288px;
@spritesheet-image: '../images/2.3.0/dist/sprite.png';
@spritesheet-sprites: @icon-copper-mini @icon-gold-mini @icon-gold-seller @icon-home-mini @icon-icon-abletrunk @icon-icon-check @icon-icon-discheck @icon-icon-disgather @icon-icon-disshopcart @icon-icon-gather @icon-icon-label @icon-icon-shopcart @icon-icon-trunk @icon-invalid-mini @icon-menu @icon-no1 @icon-no2 @icon-no3 @icon-people @icon-plus @icon-real-name-mini @icon-sliver-mini @icon-talk @icon-tip-angle @icon-wl-real-location @icon-wl-real-name;
@spritesheet: 325px 288px '../images/2.3.0/dist/sprite.png' @spritesheet-sprites;
/*
The provided classes are intended to be used with the array-like variables
.icon-home {
.sprite-width(@icon-home);
}
.icon-email {
.sprite(@icon-email);
}
*/
.sprite-width(@sprite) {
width: extract(@sprite, 5);
}
.sprite-height(@sprite) {
height: extract(@sprite, 6);
}
.sprite-position(@sprite) {
@sprite-offset-x: extract(@sprite, 3);
@sprite-offset-y: extract(@sprite, 4);
background-position: @sprite-offset-x @sprite-offset-y;
}
.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);
}
/*
The `.sprites` mixin generates identical output to the CSS template
but can be overridden inside of LESS
This must be run when you have at least 2 sprites.
If run with a single sprite, then there will be reference errors.
.sprites(@spritesheet-sprites);
*/
.sprites(@sprites, @i: 1) when (@i <= length(@sprites)) {
@sprite: extract(@sprites, @i);
@sprite-name: e(extract(@sprite, 10));
.@{sprite-name} {
.sprite(@sprite);
}
.sprites(@sprites, @i + 1);
}