在编写CSS时主要使用SASS,我现在正准备尝试LESS.通过文档阅读,我在保护mixins的上下文中与以下内容混淆:
此外,关键字true是唯一的truthy值,使这两个mixin等效:
Run Code Online (Sandbox Code Playgroud).truth (@a) when (@a) { ... } .truth (@a) when (@a = true) { ... }除关键字true之外的任何值都是假的:
Run Code Online (Sandbox Code Playgroud).class { .truth(40); // Will not match any of the above definitions. }
为什么truth(40)不匹配第一个mixin?when (@a)如果给出一个值(任何值)@a,基本上是否@a存在,是否只是声明只匹配mixin ?既然40存在一个值,为什么它在给定的mixins中找不到匹配?