-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
171 lines (154 loc) · 5.95 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
module.exports = function (grunt) {
// Project configuration.
grunt.initConfig({
clean: {
css: 'public/css/release/angular-bootstrap-web.min.css',
vendorcss: 'public/css/release/vendor-all.min.css',
vendorjs: ['public/js/release/vendor-all.js','public/js/release/vendor-all.min.js'],
js: ['public/js/release/angular-bootstrap-web.js','public/js/release/angular-bootstrap-web.min.js']
},
less: {
compile: {
options: {
strictMath: true,
sourceMap: true,
outputSourceFiles: true,
sourceMapURL: 'app.css.map',
sourceMapFilename: 'public/css/app.css.map'
},
src: 'public/less/app.less',
dest: 'public/css/app.css'
}
},
bowercopy: {
libs: {
options: {
destPrefix: 'public/js/vendor'
},
files: {
'moment.js': 'moment/moment.js',
'jquery.js': 'jquery/dist/jquery.js',
'jquery-ui.js': 'jquery-ui/jquery-ui.js',
'angular.js': 'angular/angular.js',
'angular-ui-router.js': 'angular-ui-router/release/angular-ui-router.js',
'ui-bootstrap-tpls.js': 'angular-bootstrap/ui-bootstrap-tpls.js'
}
},
css: {
options: {
destPrefix: 'public/css/vendor'
},
files: {
'font-awesome.css': 'font-awesome/css/font-awesome.css',
'animate.css': 'animate.css/animate.css',
'bootstrap.css': 'bootstrap/dist/css/bootstrap.css'
}
}
},
copy: {
vendorfonts: {
files: [
{
cwd: 'bower_components/',
src: ['font-awesome/fonts/*',
'bootstrap/dist/fonts/*',
'source-sans-pro/EOT/*',
'source-sans-pro/OTF/*',
'source-sans-pro/TTF/*',
'source-sans-pro/WOFF/OTF/*',
'source-sans-pro/WOFF/TTF/*',
'source-sans-pro/WOFF2/OTF/*',
'source-sans-pro/WOFF2/TTF/*'
],
dest: 'public/css/fonts/',
expand: true,
flatten: true
}
]
}
},
cssmin: {
target: {
files: [{
expand: true,
cwd: 'public/css/vendor',
src:['*.css', '!*.min.css'],
dest: 'public/css/vendor',
ext: '.min.css'
},
{
expand: true,
cwd: 'public/css',
src:['*.css', '!*.min.css'],
dest: 'public/css',
ext: '.min.css'
}]
}
},
concat: {
options: {
banner: '',
stripBanners: false
},
vendorcss: {
src: [
'public/css/vendor/*.min.css'
],
dest: 'public/css/release/vendor-all.min.css'
},
css: {
src: [
'public/css/*.min.css'
],
dest: 'public/css/release/angular-bootstrap-web.min.css'
},
vendorjs: {
src: ['public/js/vendor/moment.js',
'public/js/vendor/moment-timezone-with-data.js',
'public/js/vendor/jquery.js',
'public/js/vendor/jquery-ui.js',
'public/js/vendor/angular.js',
'public/js/vendor/**/*.js'],
dest: 'public/js/release/vendor-all.js'
},
js: {
src: ['public/js/app.js', 'public/js/**/*.js', '!public/js/vendor/**/*.js', '!public/js/release/**/*.js'],
dest: 'public/js/release/angular-bootstrap-web.js'
}
},
uglify: {
options: {
compress: {
warnings: false
},
mangle: true,
preserveComments: 'some'
},
vendor: {
src: 'public/js/release/vendor-all.js',
dest: 'public/js/release/vendor-all.min.js'
},
source: {
src: 'public/js/release/angular-bootstrap-web.js',
dest: 'public/js/release/angular-bootstrap-web.min.js'
}
},
watch: {
less: {
files: 'public/less/**/*.less',
tasks: 'build-css'
},
js: {
files: ['public/js/**/*.js', '!public/js/vendor/**/*.js', '!public/js/release/**/*.js'],
tasks: 'build-js'
}
}
});
require('load-grunt-tasks')(grunt, { scope: 'devDependencies' });
grunt.registerTask('compile-less', ['less:compile']);
grunt.registerTask('concat-css', ['concat:vendorcss', 'concat:css']);
grunt.registerTask('copy-vendor-assets', ['bowercopy:libs', 'bowercopy:css', 'copy:vendorfonts']);
grunt.registerTask('build-css', ['clean:css', 'less:compile', 'cssmin', 'concat:css']);
grunt.registerTask('build-js', ['clean:js', 'concat:js', 'uglify:source']);
grunt.registerTask('release', ['clean', 'less:compile', 'copy-vendor-assets', 'cssmin', 'concat', 'uglify']);
};