Good morning,
I have been messing around with the Require.js optimizer this morning and was having trouble getting started.
I am running windows 8, and have created a modular backbone.js application that I am now ready to package for deployment (production). I would now like to optimizer theses files (concat and minimize), r.js optimizer seems like just the trick.
The problem I am running into is when trying to run the classpath command.
java -classpath path/to/rhino/js.jar;path/to/closure/compiler.jar org.mozilla.javascript.tools.shell.Main r.js main.js
Will throw an error - Error: Could not find or load main class org.mozilla.javascript.tools.shell.Main
I'm confused because I'm not sure where that package is even supposed to be, wouldn't it already be part of the optimizer/compiler?
My directory structure is as follows
build -
compiler.js
js.jar
r.js
app
js -> backbone and application files here
css
images
I'd highly appreciate any light that could be shed on this one, this is the first time I am running the require.js optimizer.
The command you used attempts to run
r.js
withmain.js
as the entry point, not perform optimization (bear in mind the Optimizer is not the main component ofr.js
). You probably found the command in the r.js README; the correct command is in the same file, in the "Optimizer" section:You'll need a build profile file which should be fairly straightforward in your case. More info directly on RequireJS page.
I can highly recommend using
Node.js
instead of Rhino, it's much faster and saves setting up Java dependencies/classpath.