-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
98 lines (94 loc) · 3.11 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
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
typescript: {
base: {
src: ['src/main/webapp/assets/grunt/ts/**/*.ts'],
dest: 'src/main/webapp/assets/js/ts-all.js',
options: {
module: 'amd',
target: 'es5',
sourceMap: true
}
}
},
coffee: {
compileWithMaps: {
options: {
sourceMap: true
},
files: {
'src/main/webapp/assets/js/coffee-all.js': ['src/main/webapp/assets/grunt/coffee/**/*.coffee']
}
}
},
react: {
combined_file_output: {
files: {
'src/main/webapp/assets/js/react-all.js': ['src/main/webapp/assets/grunt/jsx/**/*.jsx']
}
}
},
less: {
development: {
options: {
sourceMap: false
},
files: {
"src/main/webapp/assets/css/application-less.css": ["src/main/webapp/assets/grunt/less/application.less"]
}
}
},
sass: {
dist: {
options: {
sourcemap: true
},
files: {
'src/main/webapp/assets/css/application-scss.css': ['src/main/webapp/assets/grunt/scss/application.scss']
}
}
},
concat: {
options: {
separator: ';',
},
dist: {
src: [
'src/main/webapp/assets/js/coffee-all.js',
'src/main/webapp/assets/js/react-all.js',
'src/main/webapp/assets/js/ts-all.js',
],
dest: 'src/main/webapp/assets/js/application-all.js',
},
},
watch: {
files: 'src/main/webapp/assets/grunt/**/*',
tasks: ['typescript', 'coffee', 'react', 'sass', 'less']
},
mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: ['test/**/*.js']
}
},
mocha_phantomjs: {
all: ['src/test/phantomjs/index.html']
},
uglify: {
my_target: {
files: {
'src/main/webapp/assets/js/application-all.min.js': ['src/main/webapp/assets/js/application-all.js']
}
}
}
});
grunt.registerTask('compile', ['typescript', 'coffee', 'react', 'sass', 'less', 'concat']);
grunt.registerTask('phantomJsTest', ['connect', 'mocha_phantomjs']);
grunt.registerTask('test', ['compile', 'mochaTest', 'phantomJsTest']);
grunt.registerTask('build', ['compile', 'mochaTest', 'uglify']);
grunt.registerTask('default', ['compile', 'uglify', 'watch']);
}