少,产生错误的输出 [英] less, producing the wrong output

查看:54
本文介绍了少,产生错误的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

主文件

@import (reference)  './kendo1.less';

.FadedGrid
{
    @import (reference)  './kendo2.less';
}

.FadedGrid
{
    @import (reference)  './kendo2.less';

    .k-grid-header th
    {
        background-color: @input-background-color;
    }
}

kendo1.less

kendo1.less

@input-background-color: #000;

kendo2.less

kendo2.less

@input-background-color: #fff;

这产生

.FadedGrid .k-grid-header th {
  background-color: #000000;
}

但是这里的颜色应该是#ffffff,而不是#000000

But the colour here should be #ffffff, not #000000

推荐答案

您需要将导入从引用更改为多个.如果将其设置为引用,则似乎会忽略同一文件的重复导入.

You need to change you import from reference to multiple. If you set it to reference it seems to ignore the duplicate imports of the same file.

导入选项: http://lesscss.org/features/#import-options

示例:

@import (reference)  './kendo1.less';

.FadedGrid
{
  @import (multiple)  './kendo2.less';
}

.FadedGrid
{
      @import (multiple)  './kendo2.less';

  .k-grid-header th
  {
    background-color: @input-background-color;
  }
}

输出:

/* Generated by less 2.4.0 */
.FadedGrid .k-grid-header th {
  background-color: #ffffff;
}

这篇关于少,产生错误的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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