-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGruntfile.js
More file actions
83 lines (79 loc) · 2.46 KB
/
Gruntfile.js
File metadata and controls
83 lines (79 loc) · 2.46 KB
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
module.exports = function(grunt) {
var _banner =
'/**! <%= pkg.discription %> \n *@version: <%= pkg.version %>-<%= grunt.template.today("yyyy/dd/mm") %>\n *@author: <%= pkg.author %>\n*/\n' +
'var YE = (function($){\n\nvar $ = $ || jQuery;\n\n';
_footer = "\nreturn YE;\n\n})(jQuery);\n";
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
banner: _banner,
footer: _footer,
separator: '\n'
},
dist: {
src: ['src/core/*.js', 'src/events/*.js', 'src/ui/*.js',
'src/utils/*.js', 'src/ajax/*.js', 'src/handler/*.js',
'src/dialog/*.js', 'src/plugin/ye_video.js',
'src/plugin/ye_image.js', 'src/plugin/ye_link.js',
'src/plugin/ye_vote.js', 'src/plugin/ye_audio.js',
'src/ykeditor/core/*.js', 'src/ykeditor/ui/*.js',
'src/ykeditor/events/*.js', 'src/ykeditor/ajax/*.js',
'src/ykeditor/plugins/*.js'
],
dest: '<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: '/**! <%= pkg.discription %> \n *@version: <%= pkg.version %>-<%= grunt.template.today("yyyy/mm/dd") %>\n *@author: <%= pkg.author %>\n*/\n'
},
dist: {
files: {
'<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
}
}
},
lineending: {
dist: { // Target
options: { // Target options
eol: 'lf'
},
files: { // Files to process
'<%= concat.dist.dest %>': ['<%= concat.dist.dest %>'],
'<%= pkg.name %>.min.js': ['<%= pkg.name %>.min.js']
}
}
},
jshint: {
files: ['Gruntfile.js', 'src/**/*.js'],
options: {
//这里是覆盖JSHint默认配置的选项
globals: {
jQuery: true,
console: true,
module: true,
document: true
}
}
},
jsdoc: {
dist: {
src: ['src/**/*.js'],
jsdoc: './node_modules/jsdoc/jsdoc.js',
options: {
configure: 'jsdoc.conf.json'
}
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-lineending');
grunt.loadNpmTasks('grunt-jsdoc');
grunt.registerTask('test', ['jshint']);
grunt.registerTask('doc', ['jsdoc']);
//file line ending unix
grunt.registerTask('default', ['jshint', 'concat', 'uglify', 'lineending']);
};