How to fix less error while compiling bootstrap?

不想你离开。 提交于 2019-12-11 02:56:42

问题


Attached is a trace while compiling using grunt dist

(webmaker)Anils-MacBook-Pro:bootstrap anil$ grunt dist
Running "clean:dist" (clean) task

Running "less:compileCore" (less) task
>> ArgumentError: error evaluating function `ceil`: argument must be a number in less/variables.less on line 48, column 27:
>> 47 @font-size-base:          15px;
>> 48 @font-size-large:         ceil(@font-size-base * 1.25); // ~18px
>> 49 @font-size-small:         ceil(@font-size-base * 0.85); // ~12px
Warning: Error compiling less/bootstrap.less Use --force to continue.

Aborted due to warnings.

The grunt-contrib-less is the latest version and as can be seen, the variable @font-size-base is defined just above and it works.

A similar thread I found https://groups.google.com/forum/#!topic/brackets-dev/ZpBOFqDc3H8 but no solutions yet.


回答1:


The solution is probably to add extra parentheses to the @font-size-large and @font-size-small lines.

Before:

@font-size-large:         ceil(@font-size-base * 1.25); // ~18px
@font-size-small:         ceil(@font-size-base * 0.85); // ~12px

After:

@font-size-large:         ceil((@font-size-base * 1.25)); // ~18px
@font-size-small:         ceil((@font-size-base * 0.85)); // ~12px

I'm guessing this has happened because you, like me, changed @font-size-base, and a bad merge for some reason protected that line, but also the following two lines. (Something changed between 3.0 and 3.1 that means those lines need double parentheses--see @font-size-h1, @font-size-h2, etc.)



来源:https://stackoverflow.com/questions/21228897/how-to-fix-less-error-while-compiling-bootstrap

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