This example shows how a project using the Lightstreamer JS client can be built using the r.js optimizer.
The project uses RequireJS as AMD loader, its domReady! plugin, the Lightstreamer JS Client 6 library and a custom MySubscriber module.
You can build the project using either Rhino (and optionally Google Closure Compiler) or Node.js. The built files will appear in the deploy folder.
A full guide to optimization is available in the RequireJS website The full list of options for the configuration file is available on r.js github repo
-
Install java on the machine.
-
from the build folder run
java -cp compiler.jar;js.jar org.mozilla.javascript.tools.shell.Main r.js -o app.build.js
-
Install node on the machine.
-
modify the build/app.build.js file removing the optimize property.
-
from the build folder run
node r.js -o app.build.js
This project contains several different external resources you may want to upgrade before using using in your own project:
- build/compiler.jar from Google Closure Compiler
- build/js.jar from Rhino
- build/r.js from r.js
- src/js/require.js from RequireJS
- src/js/domReady.js from domReady
- src/js/lightstreamer_namespace.js from Lightstreamer