/
Gruntfile.js
104 lines (101 loc) · 3.07 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
js: {
options: {
separator: ';'
},
src: [
// Add requirements manually so unused can be removed later
'lib/vendor/raphael-min.js',
'lib/vendor/chroma.js',
'lib/vendor/kartograph/kartograph.min.js',
'lib/vendor/underscore.js',
'lib/vendor/accounting.js',
'lib/vendor/thejit-2.js',
'lib/vendor/d3.v3.js',
'lib/vendor/vis4.js',
'lib/vendor/jquery.history.js',
'lib/vendor/Tween.js',
'lib/vendor/bubbletree/2.0/bubbletree.openspending.js',
'lib/vendor/jquery.qtip.min.js',
'lib/vendor/csv.js',
// Source files for openspendingjs' utilisation library
'src/utils/*.js',
// Source files for openspendingjs' jquery widgets
'src/visualisations/*.js'
],
dest: 'build/<%= pkg.version %>/<%= pkg.shortname %>.js'
},
css: {
src: ['src/css/*.css'],
dest: 'build/<%= pkg.version %>/<%= pkg.shortname %>.css'
}
},
min: {
options: {
report: grunt.option('report') ? 'gzip' : false
},
js: {
src: ['<%= concat.js.dest %>'],
dest: 'build/<%= pkg.version %>/<%= pkg.shortname %>.min.js'
}
},
cssmin : {
options: {
report: grunt.option('report') ? 'gzip' : false
},
css: {
src: ['<%= concat.css.dest %>'],
dest: 'build/<%= pkg.version %>/<%= pkg.shortname %>.min.css'
}
},
copy: {
svg: {
files: [
{ expand: true, src: ['svg/**.svg'],
cwd: 'src/',
dest: 'build/<%= pkg.version %>/icons/' }
]
}
},
compress: {
tarball: {
options: {
archive: 'releases/<%= pkg.name %>-<%= pkg.version %>.tgz',
},
expand: true,
src: ['<%= pkg.version %>/**'],
cwd: 'build/',
dest: '<%= pkg.name %>'
},
zipfile: {
options: {
archive: 'releases/<%= pkg.name %>-<%= pkg.version %>.zip',
},
expand: true,
src: ['<%= pkg.version %>/**'],
cwd: 'build/',
dest: '<%= pkg.name %>'
}
},
clean: ["build/"],
karma: {
options: {
configFile: 'karma.conf.js',
},
unit: {
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-yui-compressor');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-karma');
grunt.registerTask('default', ['concat', 'min', 'cssmin', 'copy']);
grunt.registerTask('release', ['concat', 'min', 'cssmin',
'copy', 'compress', 'clean']);
};