less(版本 2.5.3)与 Rhino(或 Nashorn)
less (ver. 2.5.3) vs Rhino(or Nashorn)
情况是 - 我在 less GitHub 上有这个问题
题目是"Rhino doesn't work with less older 2.X.X",而且我还有official less site的那个手册,上面说编译很简单!您只需要从命令行输入 运行 命令即可。但这对我不起作用。
所以我的问题很简单 - 是否有任何关于如何使用 Rhino(或者 Nashorn)编译 less 2.5.3 版本(或接近它)的主题,也许有一些技巧或第一眼看不清楚的东西。或者开发人员明确 "NO YOU CAN'T DO IT!" 的主题。
我认为答案是不,你做不到(现在)。
GitHub 问题跟踪系统中存在未解决的问题:Rhino Support in 2.x。
我还尝试使用 Less 2.5.1 和 Rhino 编译 less 源代码。不幸的是它不起作用:
org.mozilla.javascript.EcmaError: ReferenceError: "window" is not defined. (file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js#72)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3689)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3667)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3752)
at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1793)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1732)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_anonymous_8(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:72)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2429)
at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_s_4(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:13)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_e_3(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:13)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_anonymous_2(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:13)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_anonymous_1(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:13)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_script_0(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:13)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3090)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at biz.gabrys.lesscss.compiler.LessCompilerImpl.compile(LessCompilerImpl.java:125)
... 25 more
还有一个与 Nashorn 有关的未解决问题。
情况是 - 我在 less GitHub 上有这个问题 题目是"Rhino doesn't work with less older 2.X.X",而且我还有official less site的那个手册,上面说编译很简单!您只需要从命令行输入 运行 命令即可。但这对我不起作用。 所以我的问题很简单 - 是否有任何关于如何使用 Rhino(或者 Nashorn)编译 less 2.5.3 版本(或接近它)的主题,也许有一些技巧或第一眼看不清楚的东西。或者开发人员明确 "NO YOU CAN'T DO IT!" 的主题。
我认为答案是不,你做不到(现在)。 GitHub 问题跟踪系统中存在未解决的问题:Rhino Support in 2.x。
我还尝试使用 Less 2.5.1 和 Rhino 编译 less 源代码。不幸的是它不起作用:
org.mozilla.javascript.EcmaError: ReferenceError: "window" is not defined. (file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js#72)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3689)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3667)
at org.mozilla.javascript.ScriptRuntime.notFoundError(ScriptRuntime.java:3752)
at org.mozilla.javascript.ScriptRuntime.nameOrFunction(ScriptRuntime.java:1793)
at org.mozilla.javascript.ScriptRuntime.name(ScriptRuntime.java:1732)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_anonymous_8(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:72)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2429)
at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_s_4(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:13)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_e_3(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:13)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_anonymous_2(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:13)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.optimizer.OptRuntime.call0(OptRuntime.java:23)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_anonymous_1(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:13)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:32)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1._c_script_0(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js:13)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:394)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3090)
at org.mozilla.javascript.gen.file__D__Projects_lesscss_sources_compiler_target_classes_less_less_js_1.call(file:/D:/Projects/lesscss/sources/compiler/target/classes/less/less.js)
at biz.gabrys.lesscss.compiler.LessCompilerImpl.compile(LessCompilerImpl.java:125)
... 25 more
还有一个与 Nashorn 有关的未解决问题。