1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| @import './_themes.scss';
|
| // 定义混合指令, 切换主题,并将主题中的所有规则添加到theme-map中
| @mixin themify() {
|
| // 将themes中规则放入theme-map
| @each $theme-name,
| $theme-map in $themes {
| $theme-map: $theme-map !global;
|
| [data-theme="#{$theme-name}"] & {
| // 表示包含下面函数 themed(), 类似于插槽
| @content;
| $theme-map : null !global;
| }
| }
| }
|
| @function themed($key) {
| @return map-get($theme-map, $key);
| }
|
|