forked from fusioncharts/fusioncharts-jquery-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
68 lines (60 loc) · 1.93 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
"use strict";
module.exports = function(grunt) {
var pkg = grunt.file.readJSON('package.json');
// Project configuration.
grunt.initConfig({
banner: grunt.file.read("src/banner.js").replace(/@VERSION/, pkg.version),
// Task configuration.
uglify: {
options: {
banner: "<%= banner %>"
},
dist: {
src: "<%= build.dist.dest %>",
dest: "package/fusioncharts-jquery-plugin.min.js"
}
},
build: {
options: {
banner: "<%= banner %>"
},
dist: {
dest: "package/fusioncharts-jquery-plugin.js",
src: [
"src/transcoder-htmltable/transcoder-htmltable.js",
"src/fusioncharts-jquery-plugin.js"
]
}
},
jshint: {
options: pkg.jshintConfig,
all: ["src/*"]
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-jshint");
// Special concat/build task to handle FusionCharts jQuery plugin build requirements
grunt.registerMultiTask(
"build",
"Concatenate source, remove individual closures, embed version",
function() {
var data = this.data,
name = data.dest,
src = data.src,
options = this.options({
banner: ""
}),
// Start with banner
compiled = options.banner;
// Concatenate src
src.forEach(function(path) {
var source = grunt.file.read(path);
compiled += source;
});
grunt.file.write(name, compiled);
}
);
// Default task.
grunt.registerTask("default", ["jshint", "build", "uglify"]);
};