-
Notifications
You must be signed in to change notification settings - Fork 31
/
wap.handlebars
37 lines (31 loc) · 998 Bytes
/
wap.handlebars
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
@charset "utf-8";
@function rem($px, $base-font-size: 20px) {
@if unitless($px) {
@return rem($px + 0px);
}
@if unit($px) != "px" {
@error "rem()的参数单位必须是px或不带单位";
}
// $base-font-size:切图时设计稿宽度对应的媒体查询中html的font-size 或 --rfz+px
@return $px / $base-font-size + rem;
}
{{#extend "scss"}}
{{#content "sprites"}}
// 图片类内@include
{{#each sprites}}
@mixin sprites_{{name}} {
background-position: {{#if offset_x}}{{offset_x}}/({{width}}-{{total_width}})*100%{{else}}0{{/if}} {{#if offset_y}}{{offset_y}}/({{height}}-{{total_height}})*100%{{else}}0{{/if}};
width: rem({{width}});
height: rem({{height}});
@extend %sprites_img;
}
{{/each}}
{{/content}}
{{#content "spritesheet"}}
%sprites_img {
background-image: url({{{spritesheet.escaped_image}}});
background-size: rem({{spritesheet.width}}) rem({{spritesheet.height}});
background-repeat: no-repeat;
}
{{/content}}
{{/extend}}