How to correctly execute lessc-rhino-1.6.3.js from

2019-02-17 05:14发布

问题:

I'm trying "latest and greatest" LESS version and it seems it does not work in rhino command-line version. I've done following

  1. Took latest rhino from here https://github.com/downloads/mozilla/rhino/rhino1_7R4.zip
  2. Took latest less-rhino-1.6.3.js from here https://github.com/less/less.js/tree/master/dist
  3. Running following from command line

    java -jar js.jar less-rhino-1.6.3.js text.less text.css
    or
    java -jar js.jar less-rhino-1.6.3.js lessc-rhino-1.6.3.js text.less text.css

The result is - "silently nothing". When trying to run 'previous latest version' - it runs OK without problems

java -jar js.jar less-rhino-1.5.1.js text.less text.css

Output is

Written to text.css

What I'm missing about latest less-rhino.js? I could not find any relevant help in http://lesscss.org or https://github.com/less/less.js. The later jut says "stackoverflow.com is a great place to get answers about Less."

回答1:

I just found out how to do it in a nice way. Rhino has a -f flag which makes it simple to do .

java -jar js.jar -f less-rhino-1.6.3.js lessc-rhino-1.6.3.js text.less text.css

The above snippet should do the work for you. The 1.6.2 release of Less split the cli-stuff from Less into lessc-rhino-[v].js and the actual library into less-rhino-[v].js. It seems like this is an undocumented change unfortunately.