1 | var express = require('express'),
|
2 | expyui = require('express-yui'),
|
3 | Locator = require('locator'),
|
4 | LocatorHbs = require('locator-handlebars'),
|
5 | encoder = require('yui-pathogen-encoder'),
|
6 | app = express();
|
7 |
|
8 | expyui.extend(app);
|
9 |
|
10 |
|
11 | encoder.enable(app);
|
12 |
|
13 |
|
14 | app.set('view', app.yui.view());
|
15 |
|
16 |
|
17 | app.use(expyui.static());
|
18 |
|
19 |
|
20 | app.get('/', expyui.expose(), function (req, res) {
|
21 | res.render('demo');
|
22 | });
|
23 |
|
24 | app.yui.applyConfig({
|
25 | combine: true,
|
26 |
|
27 | groups: {
|
28 | 'ape-af': {
|
29 | comboBase: 'http://l.yimg.com/zz/combo?',
|
30 | root: 'os/mit/td/ape-af-0.0.38/',
|
31 | combine: true
|
32 | }
|
33 | },
|
34 |
|
35 | modules: {
|
36 | 'af-poll': {
|
37 | group: 'ape-af',
|
38 | requires: [
|
39 | 'af-pageviz'
|
40 | ]
|
41 | },
|
42 | 'af-dom': {
|
43 | group: 'ape-af',
|
44 | requires: [
|
45 | 'node-base',
|
46 | 'node-core'
|
47 | ]
|
48 | },
|
49 | 'af-pageviz': {
|
50 | group: 'ape-af',
|
51 | requires: [
|
52 | 'event-custom-base',
|
53 | 'event-custom-complex'
|
54 | ]
|
55 | }
|
56 | },
|
57 |
|
58 | gallery: 'gallery-2013.08.07-20-34',
|
59 |
|
60 | customComboBase: 'http://admin1.staging.cx.gq1.yahoo.com/combo/cc/'
|
61 | });
|
62 |
|
63 |
|
64 | new Locator({
|
65 | buildDirectory: 'build'
|
66 | })
|
67 | .plug(LocatorHbs.yui())
|
68 | .plug(app.yui.plugin({
|
69 | registerGroup: true,
|
70 | registerServerModules: true
|
71 | }))
|
72 | .parseBundle(__dirname, {}).then(function () {
|
73 |
|
74 |
|
75 | app.listen(3000, function () {
|
76 | console.log("Server listening on port 3000");
|
77 | });
|
78 |
|
79 | }, function (err) {
|
80 | console.error(err);
|
81 | console.error(err.stack);
|
82 | });
|