【问题标题】:Error with less in Sublime Text 2Sublime Text 2 中的错误较少
【发布时间】:2014-06-03 16:05:52
【问题描述】:

我在使用 ST2 编译我的 less 文件时出错。我设置了这些插件:

LESS
LESS build
SublimeOnSaveBuild
less2css

我正在尝试编译这些示例:

.generate-columns(4);

.generate-columns(@n, @i: 1) when (@i =< @n) {
  .column-@{i} {
    width: (@i * 100% / @n);
  }
  .generate-columns(@n, (@i + 1));
}

我得到这个错误:

Expected ')' but found ' ' on line 8 in file '......\public\css\prueba.less':
  [7]:   }
  [8]:   .generate-columns(@n, (@i + 1));
       ----------------------------^
  [9]: }
[Done - Failed]
[Finished in 0.2s with exit code -5]

例子来自Less官网:http://lesscss.org/features/#loops-feature

有人可以帮帮我吗?是插件的bug吗?

非常感谢,最好的问候。

【问题讨论】:

  • 您使用的是哪个构建系统?我认为它们都带有一个,除了SublimeOnSaveBuild
  • 我使用的较少。默认情况下不选中。我编译的所有东西都在工作,但那个例子不起作用。谢谢。
  • 看起来那些 ST2 插件使用的是相当旧的 Less 版本(低于 1.3.3)。我不确定,但我认为还有其他更新的插件。通过删除额外的括号,您仍然可以更早地在 Less 1.3.2 中编译此代码,即:.generate-columns(@n, @i + 1);
  • 感谢 7-phases-max,我安装了另一个插件,它的工作就像一个魅力。

标签: css less sublimetext2


【解决方案1】:

感谢 7-phases-max,我意识到我正在使用旧版 Less 的插件。最后,使用这些插件一切正常:

LESS
Less2Css

我将 Build 设置为自动。如果保存你得到这个错误:“错误:less2css错误:[WinError 2]”,你可以安装node.js,然后在终端“npm install less -g”中运行。如果您不想安装 node.js,您可以安装 LESS.js for Windows (https://github.com/duncansmart/less.js-windows) 并将其添加到系统路径。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-21
    • 2016-02-04
    • 2013-02-16
    相关资源
    最近更新 更多