UNPKG

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