1 | Connect middleware exposing the Dojo Toolkit
|
2 | ============================================
|
3 |
|
4 | This Connect middleware transparently download and display Dojo files.
|
5 |
|
6 | In its simplest form, it takes no argument and the latest stable release is used. Here is a quick example:
|
7 |
|
8 | ```javascript
|
9 | var express = require('express');
|
10 | var dojo = require('connect-dojo');
|
11 | var app = express.createServer();
|
12 | app.configure(
|
13 | app.use(express.bodyParser());
|
14 | app.use(express.methodOverride());
|
15 | app.use(express.cookieParser());
|
16 | app.use(dojo());
|
17 | app.use(app.router);
|
18 | app.use(express.static(__dirname + '/public'));
|
19 | app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
|
20 | );
|
21 | app.listen(3000);
|
22 | ```
|
23 |
|
24 | Options
|
25 | -------
|
26 |
|
27 | - *method*, support 'release' (default) and 'git'
|
28 | - *repository*, Default parent directory where source codes are downloaded
|
29 | - *version*, Dojo version, currently `'1.7.1'`, apply only to the 'download' method
|
30 |
|
31 | Using a released version of Dojo
|
32 | --------------------------------
|
33 |
|
34 | Source code is downloaded from the official Dojo website and all the versions
|
35 | present on the website are available. For example to download the version '1.5.0', setup
|
36 | the middleware as:
|
37 |
|
38 | ```javascript
|
39 | dojo({ version: '1.7.1' })
|
40 | ```
|
41 |
|
42 | Using the git HEAD
|
43 | ------------------
|
44 |
|
45 | If the option 'method' is set to 'git' and the revision option of a dojo project
|
46 | is not defined, the middleware will checkout the HEAD revision. Each Dojo project
|
47 | will be store inside a directory defined by the option 'repository' and named as "git-#{project}-HEAD"
|
48 |
|
49 | Using a specific git revision
|
50 | -----------------------------
|
51 |
|
52 | If the option 'method' is set to 'git' and one of 'dojo_revision', 'dijit_revision',
|
53 | 'dojox_revision' or 'util_revision' is defined, then the middleware to checkout
|
54 | the revision in a specific directory inside the one defined by the option 'repository'
|
55 | and named as "git-${project}-#{revision}".
|
56 |
|
57 | General note
|
58 | ------------
|
59 |
|
60 | To prevent multiple application from conflicting, a new directory is created
|
61 | for each released version and git revision. This can lead to a large number of directories
|
62 | as new revisions are setup over time. By default, source code is stored inside the
|
63 | connect-dojo module and it is recommended to define your own directory through
|
64 | the 'repository' option.
|
65 |
|
66 | Testing
|
67 | -------
|
68 |
|
69 | Running the tests can take a long time because of the size of dojo. Using
|
70 | expresso, run the following command by adjusting the '-t' (timeout) argument:
|
71 |
|
72 | ```bash
|
73 | expresso -s -t 10000 test
|
74 | ```
|