less.js保护和条件 [英] less.js guards and conditionals

查看:97
本文介绍了less.js保护和条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下较少的mixin:

I have the following less mixin:

@myColor =#123456;

.mixin(@a)when(@a = @myColor){
// do something
}

但是会抛出此错误:无法执行比较

This however throws this error: Unable to perform comparison

为什么?

推荐答案

看起来(从lesscss 1.2.2开始),守卫只支持比较维度和关键字。 (搜索源代码compare:)所以,可悲的是,比较两种颜色或字符串不会工作。

It would appear (as of lesscss 1.2.2) that guards only support comparing Dimensions and Keywords. (search the source for "compare:") So, sadly, comparing two colors or strings just won't work.

这篇关于less.js保护和条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆