-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
73 lines (70 loc) · 1.42 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
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
// Configure a mochaTest task
mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: ['test/**/*.js']
}
},
watch: {
options: {
livereload: true,
},
express: {
files: [ '*.js','routes/*.js', 'models/*.js', 'config/*.js' ],
tasks: [ 'express:dev' ],
options: {
spawn: false // Without this option specified express won't be reloaded
}
}
},
express: {
options: {
port : 3000,
node_env: 'development'
},
dev: {
options: {
script: 'app.js',
node_env: 'development'
}
},
prod: {
options: {
script: 'app.js',
node_env: 'production'
}
}
},
open: {
server: {
url: 'http://localhost:<%= express.options.port %>'
}
}
});
grunt.registerTask('test', 'mochaTest');
grunt.registerTask('server', function(arg) {
if(arg && arg == 'prod')
{
grunt.task.run([
'express:prod',
'open',
'watch'
]);
}
else
{
grunt.task.run([
'express:dev',
'open',
'watch'
]);
}
});
grunt.registerTask('default', [ 'server' ]);
grunt.registerTask('dist', [ 'server:prod' ]);
};