-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gruntfile.js
89 lines (85 loc) · 2.99 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
// Whole Gruntfile.js so far
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
dirs: grunt.file.readJSON('dirs.json'),
banner: '/*\n' +
' * <%= pkg.name %> <%= pkg.version %>\n' +
' * <%= pkg.description %>\n' +
' *\n' +
' * <%= pkg.homepage %>\n' +
' *\n' +
' * Copyright 2014-<%= grunt.template.today("yyyy") %>, <%= pkg.author %>\n' +
' * Released on: <%= grunt.template.today("mmmm d, yyyy") %>\n' +
'*/\n',
jshint: {
// define the files to lint
files: ['gruntfile.js', 'js/*.js', '!js/jquery*.js'],
// configure JSHint (documented at http://www.jshint.com/docs/)
options: {
// more options here if you want to override JSHint defaults
globals: {
jQuery: true,
console: true,
module: true
}
}
},
clean: {
src: ['<%= dirs.css.dist.all %>', '<%= dirs.js.dist.plugin %>', '<%= dirs.js.dist.all %>'],
},
uglify: {
options: {
sourceMap: false,
sourceMapRoot: './',
report: 'gzip',
compress: true,
banner: '<%= banner %>',
},
mangle: {toplevel: false},
squeeze: {dead_code: false},
codegen: {quote_keys: true},
dist: {
files: {
'<%= dirs.js.dist.plugin[0] %>':'<%= dirs.js.dev.plugin %>',
'<%= dirs.js.dist.all[0] %>':'<%= dirs.js.dev.all %>',
'<%= dirs.jsMobile.dist.plugin[0] %>':'<%= dirs.jsMobile.dev.plugin %>',
'<%= dirs.jsMobile.dist.all[0] %>':'<%= dirs.jsMobile.dev.all %>'
}
}
},
cssmin: {
options: {
banner: '<%= banner %>',
stripBanners: true,
separator: ' \n',
keepSpecialComments: 0
},
dist: {
files: {
'<%= dirs.css.dist.all[0] %>': '<%= dirs.css.dev.all %>'
}
}
},
watch: {
styles: {
files: 'css/*.css',
tasks: ['cssmin:dist']
},
scripts: {
files: 'js/*.js',
tasks: ['uglify']
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ['clean','uglify', 'cssmin']);
grunt.registerTask('jsbuild', ['uglify']);
grunt.registerTask('cssbuild', ['cssmin']);
};