ecomfe / est

EFE Styling Toolkit based on Less
http://ecomfe.github.io/est
MIT License
397 stars 70 forks source link

请问如何在node中使用est? #37

Closed yolio2003 closed 9 years ago

yolio2003 commented 9 years ago
  less.render(lesssource, {
    depends: false,
    compress: false,
    max_line_len: -1,
    lint: false,
    paths: lesspath,
    color: true,
    strictImports: false,
    insecure: false,
    rootpath: '',
    relativeUrls: false,
    ieCompat: true,
    strictMath: false,
    strictUnits: false,
    globalVars: null,
    modifyVars: null,
    urlArgs: '',
    plugins: [require('less-plugin-functions')],
  })

这样配置下来 报错

TypeError: plugin.install is not a function {stack: (...), message: "plugin.install is not a function"}
message: "plugin.install is not a function"
stack: (...)
get stack: function () { [native code] }
set stack: function () { [native code] }
__proto__: Error

另外再问个额外的问题,对于 less 不支持 sass 中 @function 的功能

@function rem($x) {
  @return $x / 40 * 1rem;
}

我找到一个插件 less-plugins-functions , 但是还想问一下,有没有更好的解决 @function 缺失的办法呢?

Justineo commented 9 years ago

README 里面更新了。

Justineo commented 9 years ago

提供额外函数必须通过插件的形式。然后通过调用 less.functions.functionRegistry.add 添加自定义函数。

yolio2003 commented 9 years ago

哈哈,搞定了,多谢大大~