This repository has been archived by the owner on Oct 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
/
app.js
68 lines (48 loc) · 1.46 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
var createServer = require("express").createServer;
var pile = require("../../index");
var js = pile.createJSManager({ outputDirectory: __dirname + "/out" });
var css = pile.createCSSManager({ outputDirectory: __dirname + "/out" });
var share = require("./share");
console.log(share.test());
function isEmail(s) {
return !! s.match(/.\w+@\w+\.\w/);
}
var app = createServer();
js.bind(app);
css.bind(app);
app.configure(function() {
app.set('views', __dirname + "/views");
});
app.configure("development", function() {
js.liveUpdate(css);
});
css.addFile(__dirname + "/style.css");
css.addFile(__dirname + "/style.styl");
css.addFile(__dirname + "/style.less");
js.addOb({MY: {
isEmail: isEmail
}
});
js.addOb({FOO: "bar"});
js.addUrl("http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js");
js.addFile(__dirname + "/client/underscore.js");
js.addFile(__dirname + "/client/backbone.js");
js.addFile(__dirname + "/client/hello.js");
js.addFile(__dirname + "/client/hello.coffee");
js.addFile("foo", __dirname + "/client/foo.coffee");
js.addFile("bar", __dirname + "/client/bar.coffee");
js.addFile(__dirname + "/share.js");
app.get("/", function(req, res){
res.exec(function() {
console.log("Run client code from the response", FOO);
console.log(share.test());
});
res.render("index.jade", {
layout: false,
js: js.renderTags("foo"),
css: css.renderTags(),
});
});
app.listen(8001, function(){
console.log("listening on 8001");
});