简体   繁体   English

如何使用LESS嵌套变量

[英]How to nest variables with LESS

I'm used to working with sass when working with projects. 在项目工作时我习惯和sass一起工作。 However I need to use less for a specific project. 但是我需要为特定项目使用less Is there a way to nest variables with less like the following example? 有没有办法嵌套变量与less像下面的例子吗?

$palettes: (
    brand: (
        base: #ffffff,
        dark: #a31f02,
        green: #61a143
    )
);

Then can be used like: 然后可以像:

$color-link: palette(brand);

The best way to solve the situations is a map . 解决问题的最佳方法是地图 It is a new feature in Less lang that allows you to get values using keys 它是Less lang中的一项新功能,允许您使用键获取值

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM