Error when compiling twitterbootstrap buttons.less on WinLess

我们两清 提交于 2020-01-13 17:03:27

问题


I get an 'eval' is null or not object on WinLess on buttons.less.

Anyone ?

ps. I have used the latest version of everything and import variables / mixins

the version I used are: WinLess 1.5.3 Less 1.3 Bootstrap 2.04

Edit:

This is fixed in Bootstrap 2.1.1


回答1:


Twitter bootstrap team states that they do not guarantee compilation of individual files like button.less. They encourage the compilation of the bootstrap.less which has all the needed dependencies. Otherwise you have to be sure that you have all the dependencies needed by button.less (usually mixins.less and variables.less).

Actually the problem seems to be related to some parsing problems in WinLess, so before it is fixed you can come around with a hack which will dupe the WinLess parser. In mixins.less, change :

// IE7 inline-block
// ----------------
.ie7-inline-block() {
  *display: inline; /* IE7 inline-block hack */
  *zoom: 1;
}

with :

// IE7 inline-block
// ----------------
.ie7-inline-block() {
  *display: inline; /* IE7 inline-block hack */
  *zoom: 1;
  // comment to make it work with WinLESS
}

As you can see it consists to the adding a new line to // comment to make it work with WinLESS to dupe the WinLess parser and make it work!




回答2:


There is another work around.

Remove the comments in button.less at

    .btn {
  display: inline-block;
  .ie7-inline-block();
  padding: 4px 10px 4px;
  margin-bottom: 0; // For input.btn
  font-size: @baseFontSize;
  line-height: @baseLineHeight;
  *line-height: 20px;
  color: @grayDark;
  text-align: center;
  text-shadow: 0 1px 1px rgba(255,255,255,.75);
  vertical-align: middle;
  cursor: pointer;
  .buttonBackground(@btnBackground, @btnBackgroundHighlight);
  border: 1px solid @btnBorder;
  *border: 0; **// Remove the border to prevent IE7's black border on input:focus  [remove this]**
  border-bottom-color: darken(@btnBorder, 10%);
  .border-radius(4px);
  .ie7-restore-left-whitespace(); **// Give IE7 some love [remove this]**
  .box-shadow(~"inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05)");
}


来源:https://stackoverflow.com/questions/11285295/error-when-compiling-twitterbootstrap-buttons-less-on-winless

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!