forked from CrimeVisualizer/DiveStop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
111 lines (96 loc) · 2.44 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/* Wrapper function */
module.exports = function(grunt){
/* Initialize grunt tasks */
grunt.initConfig({
/* Importing metadata from package.json */
pkg: grunt.file.readJSON('package.json'),
/* Uglify with concat & sourceMap */
uglify: {
options: {
mangle: false,
sourceMap: true
},
build: {
src: ['client/**/*.js', '!client/libs/**/*.js'],
dest: 'client/build/ugly.min.js'
}
},
jshint: {
all: ['client/**/*.js', 'server/**/*.js', '!client/libs/**/*.js', '!client/stub.js', '!client/build/**/*', 'test/**/*.js'],
options: {
loopfunc: true
}
},
watch: {
client_js_changes: {
/* Will test (and lint) new code, and build if pass. Will livereload on default port */
files: ['client/**/*.js', '!client/lib/**/*.js'],
tasks: ['jshint', 'exec:test_client', 'uglify'],
options: {
livereload: true
}
},
client_sass_changes: {
files: ['client/**/*.sass'],
tasks: ['sass'],
options: {
livereload: true
}
},
server_changes: {
/* If tests in server are updated or files in the server folder */
files: ['server/**/*.js'],
tasks: ['exec:test_server']
}
},
/* For executing command line scripts */
exec: {
test: {
command: 'mocha test test/**/*.js'
},
test_server: {
command: 'mocha test test/server/**/*.js'
},
test_client: {
command: 'mocha test test/client/**/*.js'
}
},
sass: {
dist: {
files: {
'client/build/style.css': 'client/styles/*.sass'
}
}
}
});
/* Load Tasks from npm */
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-exec');
/* Register custom tasks. Default is just a building */
grunt.registerTask('default', [
'sass'
]);
grunt.registerTask('test', [
'jshint',
'exec:test'
]);
grunt.registerTask('build', [
'sass',
// 'uglify'
]);
grunt.registerTask('test-server', [
'jshint',
'exec:test_server'
]);
grunt.registerTask('test-client', [
'jshint',
'exec:test_client'
]);
grunt.registerTask('sassify', [
'sass'
]);
}