-
Notifications
You must be signed in to change notification settings - Fork 102
/
Gruntfile.js
45 lines (42 loc) · 1.28 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
module.exports = function(grunt){
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %> */',
mangle:true
},
my_target: {
files: {
'public/js/min/header.min.js': ['public/js/tgy/header.js']
}
}
},
jshint: {
files: ['public/js/tgy/*.js','models/*.js','routes/*.js'],
options: {
globals: {
exports: true
}
}
},
watch: {
files: ['public/js/tgy/header.js'],
tasks: ['uglify']
},
qunit: {
files: ['test/*.html']
}
});
// 加载提供"uglify"任务的插件
grunt.loadNpmTasks('grunt-contrib-uglify');
//uglify插件需要解决生产环境和开发环境切换问题,开发环境需要随时调试没有压缩的js
grunt.loadNpmTasks('grunt-contrib-jshint');
//jshint 很好用,规范代码
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-qunit');
// 默认任务
grunt.registerTask('default', ['uglify','jshint']);
//grunt.registerTask('default', ['qunit']);
}