无法使grunt-contrib更少导入正确

我有以下少

.signature-overlay {
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: #000;
  position: absolute;
  **.opacity(.6);**
}

以及我的grunt文件中的以下内容……

less: {
  development: {
    options: {
  paths: ["default/less","default/less/bootstrap"]
    },
    files: {
      "css/less.css": ['less/*.less']
    }
  }
}

默认情况下声明和不透明度/ less / bootstrap / mixins.less

.opacity(@opacity) {
  opacity: @opacity;
  // IE8 filter
  @opacity-ie: (@opacity * 100);
  filter: ~"alpha(opacity=@{opacity-ie})";
}

但是当我咕噜咕噜的时候,我得到……

Running "less:development" (less) task
>> NameError: .opacity is undefined in less/sigature.less on line 61, column 5:
>> 60     position: absolute;
>> 61     .opacity(.6);
>> 62   }
Warning: Error compiling less/signature.less Us
--force to continue.

最佳答案 问题是你需要包含mixins.less像这样:

@import "bootstrap/mixins.less"; //I don't know you folder organizations

//..code...

.signature-overlay {
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: #000;
  position: absolute;
  .opacity(.6);
}
点赞