NAND
NAND

Reputation: 130

Can the RequireJS optimiser tool used without Node.js?

Is it possible to use anything other than Node.js to run r.js to minimize the amount of HTTP request that are made using RequireJS. I have read a lot of websites and tutorials but still everything is explained using Node.

I would appreciate a working example if possible.

Upvotes: 0

Views: 80

Answers (1)

Louis
Louis

Reputation: 151380

Yes, it can. The documentation states:

The optimizer can be run using Node, Java with Rhino or Nashorn, or in the browser.

The README for r.js contains examples of how to use it with Rhino or Nashorn. With Nashorn, quoting from the documentation:

jjs -scripting path/to/r.js -- [r.js command line arguments here]

With Rhino:

java -classpath path/to/rhino/js.jar:path/to/closure/compiler.jar org.mozilla.javascript.tools.shell.Main r.js [r.js command line arguments here]

(The documentation does not have [r.js command line arguments here] but reading the whole documentation implies that it is how it works.)

Upvotes: 1

Related Questions