合并多个Sass贴图 [英] Merge multiple Sass maps
本文介绍了合并多个Sass贴图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有3个Sass地图,我想合并为一张地图.使用map-merge功能,我只能将两个地图合并在一起.如何合并两个以上的地图?
I have three Sass maps that I want to merge into one map. With the map-merge function I can only merge two maps together. How can I merge more than two maps?
我的情况的简化示例:
$color-name: (
blue: (
default: blue,
dark: navy,
light: sky
)
);
$color-event: (
danger: (
default: set($color-name, red),
dark: set($color-name, red, dark),
light: set($color-name, red, light),
)
);
$color-category: (
heading: (
default: set($color-name, grey),
dark: set($color-name, grey, dark),
light: set($color-name, grey, light)
)
);
$color: map-merge($color-name, $color-event, $color-category);
推荐答案
如果map-merge接受2个映射并返回一个映射,但是您有3个映射...则使用map-merge两次.
If map-merge takes 2 mappings and returns a single mapping, but you have 3 mappings... you use map-merge twice.
$color: map-merge(map-merge($color-name, $color-event), $color-category);
这篇关于合并多个Sass贴图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文