-
Notifications
You must be signed in to change notification settings - Fork 11
/
Gruntfile.js
109 lines (105 loc) · 3.1 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
module.exports = function(grunt){
grunt.initConfig({
root: 'app/'
, uglify: {
js: {
files: {
'<%= root %>bootstrap.js': '<%= root %>bootstrap.min.js'
, '<%= root %>config.js': '<%= root %>config.js'
}
}
}
, htmlmin: {
options: {
removeComments: true
, collapseWhitespace: true
}
, frame: {
files: {
"<%= root %>index.html": "<%= root %>index.html"
}
}
, templates: {
expand: true
, cwd: "<%= root %>modules/"
, src: ['**/*.html']
, dest: "<%= root %>modules/"
}
}
, cssmin: {
minify: {
expand: true
, cwd: '<%= root %>css/'
, src: ['*.css', '!main.css']
, dest: '<%= root %>css/'
}
, combine: {
files: {
'<%= root %>css/main.css': ['<%= root %>css/matrix-style.css', '<%= root %>css/matrix-media.css', '<%= root %>css/jquery.gritter.css', '<%= root %>css/matrix-media.css', '<%= root %>css/table-fixed-header.css', '<%= root %>css/font-awesome.css', '<%= root %>css/nprogress.css']
}
}
}
, requirejs: {
compile:{
options: {
name: "bootstrap"
, baseUrl: "<%= root %>"
, mainConfigFile: "<%= root %>bootstrap.js"
, out: "<%= root %>bootstrap.min.js"
, optimize: "none"
, useStrict: true
, paths: {
'angular/angular': 'empty:'
, 'jquery/jquery': 'empty:'
, 'lib/bootstrap': 'empty:'
, 'jquery/jquery.gritter.min': 'empty:'
, 'jquery/table-fixed-header': 'empty:'
, 'jquery/jquery.ztree.all-3.5.min': 'empty:'
, 'angular/angular-resource': 'empty:'
, 'angular/angular-route': 'empty:'
, 'angular/angular-animate': 'empty:'
, 'angular/angular-strap': 'empty:'
, 'angular/bootstrap-datepicker': 'empty:'
, 'angular/bootstrap-datepicker.zh-CN': 'empty:'
, 'jquery/bootstrap-switch.min': 'empty:'
, 'angular/angular-sanitize.min': 'empty:'
, 'lib/console-min': 'empty:'
, 'lib/modernizr': 'empty:'
, 'jquery/nprogress': 'empty:'
}
}
}
}
, hashres: {
options: {
encoding: 'utf8'
, fileNameFormat: '${name}.${hash}.${ext}'
, renameFiles: true
}
, indexJS: {
src: '<%= root %>bootstrap.js'
, dest: '<%= root %>index.html'
}
, configJS: {
src: '<%= root %>config.js'
, dest: '<%= root %>login.html'
}
, mainCSS: {
src: '<%= root %>css/main.css'
, dest: '<%= root %>index.html'
}
}
, clean: {
js: {
src: ['<%= root %>modules/**/controllers', '<%= root %>modules/**/services', '<%= root %>modules/**/init.js', '<%= root %>modules/**/route.js', '<%= root %>common', '<%= root %>bootstrap.min.js', '<%= root %>app.js', '<%= root %>utils']
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-hashres');
grunt.registerTask('default', ['requirejs','uglify', 'cssmin', 'htmlmin', 'hashres', 'clean']);
};