Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a dojo build using nodejs?

I'm currently using the dojotoolkit and its build system. I read the new build tutorial for 1.8 at http://dojotoolkit.org/documentation/tutorials/1.8/build/. In the tutorial it mentions that you can speed up your build by using nodejs.

The build tool itself relies on Java (and, optionally, Node.js for even faster builds), so make sure that have you that installed as well.

But it fails to mention how to do this. Anyone know how this works?

like image 849
joelwat Avatar asked Nov 05 '12 11:11

joelwat


People also ask

Is Nodejs good for web development?

Node. js for web development is a revolutionary technology that offers unique features. Developers regard it as one of the most efficient cross-platforms JavaScript environments that can help you build robust and effective REST APIs, mobile applications, and web applications.

What is Dojo js used for?

The Dojo Toolkit is a powerful open source JavaScript library that can be used to create rich and varied user interfaces running within a browser. The library requires no browser-side runtime plug-in and runs natively on all major browsers.

Is Dojo a JavaScript framework?

Dojo is a JavaScript framework for developing AJAX based applications. It is released as an open source software. It can be acknowledged as one of the most powerful language for building rich internet applications.

Is node good for big projects?

Because of its non-blocking event loop mechanism, it enables developers to build highly scalable and cross-platform web applications easily. It is also a primary choice of startups. So, Node. js is the right choice for big projects.


2 Answers

I normally run it like this:

> node dojo/dojo.js load=build --profile myprofile.profile.js --release

This would build a release for the profile contained in myprofile.profile.js. It assumes you are in a directory, which contains both dojo and util as sub-directories. It also assumes that the path to node is set correctly.

If node is not configured in the path variable, you will need to use the full path to node:

> <path to node here> dojo/dojo.js load=build --profile myprofile.profile.js --release

On windows the path is normally C:\Program Files\nodejs\ but you might have to configure it as C:\PROGRA~1\nodejs\ to get it working.


Windows Notes:
The build scripts do not work with Node on Windows (except using Cygwin). If you are using Windows you can get it to work via the following patch:

  • Windows Patch

Use the attached node-win.patch file to edit the files: util/build/main.js and util/build/transforms/writeOptimized.js. The patch has worked for me 100% of the time and it a simple matter editing a few lines of code.

I've personally found the alternative to Node, using Rhino, useless. It always fails to detect the build paths correctly, no-matter what I set basePath to. I would strongly advise using Node over Rhino as it is more reliable and easier to setup.

like image 99
Stephen Simpson Avatar answered Nov 04 '22 13:11

Stephen Simpson


The buildscript util/buildscripts/build.sh checks if node is in your path and if so uses it.

This is currently not working under Windows (http://bugs.dojotoolkit.org/ticket/15413).

like image 43
xMartin Avatar answered Nov 04 '22 12:11

xMartin