forked from Esri/ago-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
75 lines (71 loc) · 2.68 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
/*global module:false*/
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
// Task configuration.
clean: {
// Clean up build files.
src: ['src/js/portal/*.min.js', 'src/js/main.min.js'],
build: ['build/**']
},
jshint: {
// Validate the javascripts.
all: ['Gruntfile.js', 'src/js/*.js', 'src/js/portal/*.js']
},
concat: {
// Combine files where it makes sense.
options: {
separator: ';'
},
build_index: {
src: ['src/index.html', 'src/templates.html'],
dest: 'build/index.html'
}
},
uglify: {
// Minify the javascript files.
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> */\n'
},
build: {
files: {
'src/js/main.min.js': 'src/js/main.js',
'src/js/portal/portal.min.js': 'src/js/portal/portal.js',
'src/js/portal/util.min.js': 'src/js/portal/util.js'
}
}
},
copy: {
// Copy everything to the build directory for testing.
main: {
files: [
{expand: true, cwd: 'src/', src: ['*.html'], dest: 'build/'},
{expand: true, cwd: 'src/', src: ['assets/**'], dest: 'build/'},
{expand: true, cwd: 'src/', src: ['css/**'], dest: 'build/'},
{expand: true, cwd: 'src/', src: ['js/*'], dest: 'build/',
rename: function(src, dest) {
return src + dest.replace('.min', '');
}
},
{expand: true, cwd: 'src/', src: 'js/portal/*', dest: 'build/',
rename: function(src, dest) {
return src + dest.replace('.min', '');
}
},
{expand: true, cwd: 'src/', src: ['js/lib/**'], dest: 'build/'}
]
}
},
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy');
// Default task.
grunt.registerTask('default', ['clean', 'jshint', 'concat', 'uglify', 'copy']);
grunt.registerTask('cleanup', ['clean']);
};