forked from kindsoft/kindeditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
119 lines (108 loc) · 3.12 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
module.exports = function(grunt) {
var BANNER = '/* <%= pkg.name %> <%= pkg.version %> (<%= grunt.template.today("yyyy-mm-dd") %>), Copyright (C) kindsoft.net, Licence: http://kindeditor.net/license.php */\r\n';
var SRC_FILES = [
'src/header.js',
'src/core.js',
'src/config.js',
'src/event.js',
'src/html.js',
'src/selector.js',
'src/node.js',
'src/range.js',
'src/cmd.js',
'src/widget.js',
'src/edit.js',
'src/toolbar.js',
'src/menu.js',
'src/colorpicker.js',
'src/uploadbutton.js',
'src/dialog.js',
'src/tabs.js',
'src/ajax.js',
'src/main.js',
'src/footer.js',
];
var PLUGIN_FILES = [
'plugins/anchor/anchor.js',
'plugins/autoheight/autoheight.js',
'plugins/baidumap/baidumap.js',
'plugins/map/map.js',
'plugins/clearhtml/clearhtml.js',
'plugins/code/code.js',
'plugins/emoticons/emoticons.js',
'plugins/filemanager/filemanager.js',
'plugins/flash/flash.js',
'plugins/image/image.js',
'plugins/insertfile/insertfile.js',
'plugins/lineheight/lineheight.js',
'plugins/link/link.js',
'plugins/map/map.js',
'plugins/media/media.js',
'plugins/multiimage/multiimage.js',
'plugins/pagebreak/pagebreak.js',
'plugins/plainpaste/plainpaste.js',
'plugins/preview/preview.js',
'plugins/quickformat/quickformat.js',
'plugins/table/table.js',
'plugins/template/template.js',
'plugins/wordpaste/wordpaste.js',
'plugins/fixtoolbar/fixtoolbar.js'
];
var pkg = grunt.file.readJSON('package.json');
var lang = grunt.option('lang') || 'en';
grunt.initConfig({
pkg : pkg,
concat : {
options : {
process : function(src, filepath) {
src = src.replace(/\$\{VERSION\}/g, pkg.version + ' (' + grunt.template.today('yyyy-mm-dd') + ')');
src = src.replace(/\$\{THISYEAR\}/g, grunt.template.today('yyyy'));
src = src.replace(/\/\*\*(\r\n|\n)[\s\S]*?\*\//g, '');
src = src.replace(/(^|\s)\/\/.*$/mg, '');
src = src.replace(/(\r\n|\n)\/\*\*\/.*(\r\n|\n)/g, '');
src = src.replace(/[ \t]+$/mg, '');
src = src.replace(/(\r\n|\n){2,}/g, '$1');
return src;
}
},
build : {
src : SRC_FILES.concat('lang/' + lang + '.js').concat(PLUGIN_FILES),
dest : 'kindeditor-all.js'
}
},
uglify : {
options : {
banner : BANNER,
},
build : {
src : '<%= pkg.filename %>-all.js',
dest : '<%= pkg.filename %>-all-min.js'
}
},
compress : {
main : {
options: {
archive: 'dist/<%= pkg.filename %>-<%= pkg.version %>-' + lang + '.zip',
},
files: [
{src: ['asp/**'], dest: 'kindeditor/'},
{src: ['asp.net/**'], dest: 'kindeditor/'},
{src: ['attached'], dest: 'kindeditor/'},
{src: ['jsp/**'], dest: 'kindeditor/'},
{src: ['lang/**'], dest: 'kindeditor/'},
{src: ['php/**'], dest: 'kindeditor/'},
{src: ['plugins/**'], dest: 'kindeditor/'},
{src: ['themes/**'], dest: 'kindeditor/'},
{src: ['kindeditor*.js'], dest: 'kindeditor/'},
{src: ['license.txt'], dest: 'kindeditor/'},
]
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.registerTask('build', ['concat', 'uglify']);
grunt.registerTask('zip', ['build', 'compress']);
grunt.registerTask('default', 'build');
};