-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
43 lines (42 loc) · 1.25 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
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
meta: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> <%= pkg.homepage %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
unwrap: {
options: {
globalBase: "lib/global_modules"
},
scripts: {
src: 'src/<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.js'
}
},
uglify: {
build: {
src: 'build/<%= pkg.name %>.js',
dest: 'build/<%= pkg.name %>.min.js'
}
},
watch: {
scripts: {
files: 'src/*.js',
tasks: ['unwrap', 'uglify']
},
html: {
files: 'test/*'
}
}
});
// 加载包含 "uglify" 任务的插件。
grunt.loadNpmTasks('grunt-contrib-uglify');
// 加载包含 "watch" 任务的插件。
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.event.on('watch', function(action, filepath, target) {
grunt.log.writeln(target + ':' + filepath + ' has' + action);
});
// 加载包含 "unwrap" 任务的插件。
grunt.loadNpmTasks('grunt-unwrap');
grunt.registerTask('default', ['watch']);
};