-
Notifications
You must be signed in to change notification settings - Fork 7
/
Gruntfile.js
85 lines (79 loc) · 2.19 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
module.exports = function(grunt) {
'use strict';
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
gruntfile_js: 'Gruntfile.js',
build_dir: 'build',
build_dir_js: '<%= build_dir %>/resources/main/public/js',
build_app_js: '<%= build_dir_js %>/app.js',
build_app_min_js: '<%= build_dir_js %>/app.min.js',
src_dir: 'src/main/resources/public',
src_dir_js: '<%= src_dir %>/js',
src_app_js: '<%= src_dir_js %>/app.js',
src_files_js: '<%= src_dir_js %>/**/*.js',
jshint: {
options: {
boss: true,
browser: true,
curly: true,
esnext: true,
globals: {
angular: true,
'_': true,
'$': true,
},
immed: true,
newcap: true,
noarg: true,
node: true,
sub: true,
undef: false,
unused: true,
quotmark: 'single',
validthis: true
},
dist: {
src: [ '<%= gruntfile_js %>', '<%= src_files_js %>' ]
}
},
concat: {
options: {
separator: grunt.util.linefeed
},
// first build without app.js
core: {
src: [ '<%= src_files_js %>', '!<%= src_app_js %>' ],
dest: '<%= build_app_js %>'
},
// second build with prepended app.js
dist: {
src: [ '<%= src_app_js %>', '<%= concat.core.dest %>' ],
dest: '<%= concat.core.dest %>'
}
},
uglify: {
options: {
// the banner is inserted at the top of the output
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
},
dist: {
src: '<%= concat.dist.dest %>',
dest: '<%= build_app_min_js %>'
}
},
clean: {
js: [ '<%= build_dir_js %>/*.js', '!<%= build_app_min_js %>' ]
},
watch: {
scripts: {
files: [ '<%= gruntfile_js %>', '<%= src_files_js %>' ],
tasks: [ 'default' ]
}
}
});
// the build task for production usage without devDependencies
grunt.registerTask('build', [ 'concat', 'uglify', 'clean' ]);
// the default task for development usage
grunt.registerTask('default', [ 'jshint', 'build' ]);
};