-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscss_combined_maps.template.mustache
50 lines (43 loc) · 1.19 KB
/
scss_combined_maps.template.mustache
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
{
// Default options
'functions': true,
'spriteName': 'sprites'
}
${{options.spriteName}}: (
{{#items}}
{{name}}: (
x: {{px.x}},
y: {{px.y}},
offset_x: {{px.offset_x}},
offset_y: {{px.offset_y}},
width: {{px.width}},
height: {{px.height}},
total_width: {{px.total_width}},
total_height: {{px.total_height}},
image: '{{{escaped_image}}}'
),
{{/items}}
);
{{#options.functions}}
@function sprite_{{options.spriteName}}($sprite, $attribute) {
@return map-get(map-get(${{options.spriteName}}, $sprite), $attribute)
}
@mixin sprite-width($sprite) {
width: sprite_{{options.spriteName}}($sprite, 'width');
}
@mixin sprite-height($sprite) {
height: sprite_{{options.spriteName}}($sprite, 'height');
}
@mixin sprite-position($sprite) {
background-position: sprite_{{options.spriteName}}($sprite, 'offset_x') sprite_{{options.spriteName}}($sprite, 'offset_y');
}
@mixin sprite-image($sprite) {
background-image: url(sprite_{{options.spriteName}}($sprite, 'image'));
}
@mixin sprite($sprite) {
@include sprite-image($sprite);
@include sprite-position($sprite);
@include sprite-width($sprite);
@include sprite-height($sprite);
}
{{/options.functions}}