-
Notifications
You must be signed in to change notification settings - Fork 351
/
Gruntfile.js
executable file
·130 lines (117 loc) · 3.78 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
module.exports = function(grunt) {
"use strict"
var banner =
"/*\n" +
" * jsGrid v<%= pkg.version %> (<%= pkg.homepage %>)\n" +
" * (c) <%= grunt.template.today('yyyy') %> <%= pkg.author %>\n" +
" * Licensed under <%= pkg.license.type %> (<%= pkg.license.url %>)\n" +
" */\n";
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
copy: {
imgs: {
expand: true,
cwd: "css/",
src: "*.png",
dest: "dist/"
},
i18n: {
expand: true,
cwd: "src/i18n/",
src: "*.js",
dest: "dist/i18n/",
rename: function(dest, src) {
return dest + "jsgrid-" + src;
}
}
},
concat: {
options: {
banner: banner + "\n",
separator: "\n"
},
js: {
src: [
"src/jsgrid.core.js",
"src/jsgrid.load-indicator.js",
"src/jsgrid.load-strategies.js",
"src/jsgrid.sort-strategies.js",
"src/jsgrid.validation.js",
"src/jsgrid.field.js",
"src/fields/jsgrid.field.text.js",
"src/fields/jsgrid.field.number.js",
"src/fields/jsgrid.field.textarea.js",
"src/fields/jsgrid.field.select.js",
"src/fields/jsgrid.field.checkbox.js",
"src/fields/jsgrid.field.control.js"
],
dest: "dist/<%= pkg.name %>.js"
},
css: {
src: "css/jsgrid.css",
dest: "dist/<%= pkg.name %>.css"
},
theme: {
src: "css/theme.css",
dest: "dist/<%= pkg.name %>-theme.css"
}
},
"string-replace": {
version: {
files: [{
src: "<%= concat.js.dest %>",
dest: "<%= concat.js.dest %>"
}],
options: {
replacements: [{
pattern: /"@VERSION"/g,
replacement: "'<%= pkg.version %>'"
}]
}
}
},
imageEmbed: {
options: {
deleteAfterEncoding : true
},
theme: {
src: "<%= concat.theme.dest %>",
dest: "<%= concat.theme.dest %>"
}
},
uglify: {
options : {
banner: banner + "\n"
},
js: {
src: "<%= concat.js.dest %>",
dest: "dist/<%= pkg.name %>.min.js"
}
},
cssmin: {
options : {
banner: banner
},
css: {
src: "<%= concat.css.dest %>",
dest: "dist/<%= pkg.name %>.min.css"
},
theme: {
src: "<%= concat.theme.dest %>",
dest: "dist/<%= pkg.name %>-theme.min.css"
}
},
qunit: {
files: ["tests/index.html"]
}
});
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-image-embed");
grunt.loadNpmTasks("grunt-contrib-cssmin");
grunt.loadNpmTasks("grunt-contrib-qunit");
grunt.loadNpmTasks('grunt-string-replace');
grunt.registerTask("default", ["copy", "concat", "string-replace", "imageEmbed", "uglify", "cssmin"]);
grunt.registerTask("test", "qunit");
};