-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
75 lines (71 loc) · 2.52 KB
/
Gruntfile.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
69
70
71
72
73
74
75
module.exports = function ( grunt ) {
// load grunt tasks
[
'grunt-run',
'grunt-open',
'grunt-contrib-watch',
'grunt-contrib-connect'
].forEach( grunt.loadNpmTasks.bind( grunt ) );
// configure
grunt.initConfig({
// connect (serve) module
connect : {
// This is the sub-task which will start a "regular" serving,
// e.g. w/o performance test debugging lines.
regular : {
options : {
port : 9000,
middleware : function ( connect ) {
return [
connect.static( require('path').resolve('web') ) // return the "web" directory as root
];
}
}
},
// This is the sub-task which will start a "perftest" serving,
// e.g. with performance test debugging lines.
perftest : {
options : {
port : 9000,
middleware : function ( connect ) {
var path = require('path');
return [
connect.static( path.resolve('Tests') ), // serve files from "Tests" directory with priority
connect.static( path.resolve('web') )
];
}
}
}
},
// configuration for "open" module
open : {
server : {
path : 'http://localhost:9000'
}
},
watch : {
// this is just to prevent server from dying
},
run : {
options : {
cwd : './' // current working directory
},
perftest : {
args : ['Tests/test.js'] // the default cmd is `node`
}
}
});
// Start a "regular" server
grunt.registerTask( 'start:regular', 'Serve regular resources', [
'connect:regular', // start a regular server
'open', // open the project in the browser
'watch' // don't kill the server yet...
]);
// Start a server that will serve files with performance tests in them
grunt.registerTask( 'start:perftest', 'Serve resources with performance tests', [
'run', // generate the files with performance debuggers
'connect:perftest', // start the server, which will serve the above static files
'open', // open the project in the browser
'watch' // don't kill the server yet...
]);
};