【问题标题】:How to fix less error while compiling bootstrap?如何在编译引导程序时修复更少的错误?
【发布时间】:2014-01-31 06:10:04
【问题描述】:

附加的是使用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.

grunt-contrib-less 是最新版本,可以看出,变量@font-size-base 就在上面定义并且可以正常工作。

我找到了一个类似的帖子 https://groups.google.com/forum/#!topic/brackets-dev/ZpBOFqDc3H8,但还没有解决方案。

【问题讨论】:

  • 看起来它是用--strict-math=on Less 选项编译的,但 Boosrtrap 3.0.3(及以下)需要--strict-math=off。 (相反,当前的 Boostrap master 需要--strict-math=on)。

标签: twitter-bootstrap less twitter-bootstrap-3


【解决方案1】:

解决方案可能是在@font-size-large@font-size-small 行中添加额外的括号。

之前:

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

之后:

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

我猜这是因为您和我一样更改了@font-size-base,并且由于某种原因错误的合并保护了该行,但也保护了以下两行。 (在 3.0 和 3.1 之间发生了一些变化,这意味着这些行需要双括号——请参阅 @font-size-h1@font-size-h2 等)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-06-24
    • 2014-03-10
    • 1970-01-01
    • 2020-03-06
    • 1970-01-01
    • 1970-01-01
    • 2020-10-28
    • 1970-01-01
    相关资源
    最近更新 更多