-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
255 lines (218 loc) · 7 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
/**
* grunt-conrtib-clean
*
* Removes files and directories.
*
* @type {Object}
*/
clean: {
dist: ['.tmp']
},
/**
* grunt-contrib-concat
*
* Concatenates multiple files into a single file.
*
* @type {Object}
*/
concat: {
options: {
banner: '/* \n * <%= pkg.name %> - concat - <%= grunt.template.today("dddd, mmmm dS, yyyy, h:MM:ss TT") %> \n */\n',
stripBanners: true
},
/* concat:styles concats just our css files. */
styles: {
src: [
'bower_components/ng-notify/src/styles/ng-notify.css',
'bower_components/nprogress/nprogress.css',
'app/styles/normalize.css',
'app/styles/main.css',
'app/styles/**/*.css',
'.tmp/**/*.sass'
],
dest: '.tmp/<%= pkg.name %>.css'
},
/* concat:scripts concats just our js files. */
scripts: {
src: [
'bower_components/angular/angular.js',
'bower_components/angular-ui-router/release/angular-ui-router.js',
'bower_components/ng-notify/src/scripts/ng-notify.js',
'bower_components/nprogress/nprogress.js',
'app/scripts/plugins/**/*.js',
'app/scripts/angular/module.js',
'app/scripts/angular/**/*.js'
],
dest: '.tmp/<%= pkg.name %>.js'
}
},
/**
* grunt-contrib-cssmin
*
* Minifies our css files.
*
* @type {Object}
*/
cssmin: {
options: {
banner: '/* \n * <%= pkg.name %> - minify - <%= grunt.template.today("dddd, mmmm dS, yyyy, h:MM:ss TT") %> \n */',
stripBanners: true,
keepSpecialComments: 0
},
dist: {
src: '.tmp/*.css',
dest: 'public/css/client.min.css'
}
},
/**
* grunt-contrib-htmlmin
*
* Minifies our html files.
*
* @type {Object}
*/
htmlmin: {
options: {
removeComments: true,
collapseWhitespace: true
},
/* htmlmin:index processes our primary index file. */
index: {
files: {
'public/index.html': 'app/index.html'
}
},
/* htmlmin:partials processes all of our app partials. */
partials: {
files: [{
expand: true,
cwd: 'app/partials/',
src: ['*.html'],
dest: 'public/partials/',
ext: '.html'
}]
}
},
/**
* grunt-contrib-imagemin
*
* Optimizes our images.
*
* @type {Object}
*/
imagemin: {
dist: {
files: [{
expand: true,
cwd: 'app/images',
src: ['**/*.{png,jpg,jpeg,gif,ico}'],
dest: 'public/img/'
}]
}
},
/**
* grunt-contrib-jshint
*
* Lints our javascript files for issues.
*
* @type {Object}
*/
jshint: {
options: {
browser: true,
globals: {
'angular': false,
}
},
dist: {
src: ['app/scripts/angular/**/*.js']
}
},
/**
* grunt-contrib-sass
*
* Compiles our sass files into css files.
*
* @type {Object}
*/
sass: {
dist: {
src: 'app/styles/main.sass',
dest: '.tmp/<%= pkg.name %>.sass'
}
},
/**
* grunt-contrib-uglify
*
* Minifies and uglifies our javascript for smaller files and faster loading.
*
* @type {Object}
*/
uglify: {
options: {
banner: '/* \n * <%= pkg.name %> - uglify - <%= grunt.template.today("dddd, mmmm dS, yyyy, h:MM:ss TT") %> \n */\n',
stripBanners: true,
sourceMap: true
},
dist: {
src: '.tmp/<%= pkg.name %>.js',
dest: 'public/js/<%= pkg.name %>.min.js'
}
},
/**
* grunt-contrib-watch
*
* Watches our project for changes, builds appropriate elements to keep app up to date.
*
* @type {Object}
*/
watch: {
/* watch:index watches for changes in our primary index file and rebuilds it. */
index: {
files: ['app/index.html'],
tasks: ['index']
},
/* watch:partials watches for changes in any of our partials and rebuilds them. */
partials: {
files: ['app/partials/**/*.html'],
tasks: ['partials']
},
/* watch:css watches for changes in any of our styles and recompiles them. */
css: {
files: ['app/styles/**/*.sass', 'app/styles/**/*.css'],
tasks: ['styles', 'clean']
},
/* watch:scripts watches for changes in any of our scripts and rebuilds them. */
scripts: {
files: ['app/scripts/**/*.js'],
tasks: ['scripts', 'clean']
},
/* watch:images watches for changes in any of our images and reoptimizes them. */
images: {
files: ['app/images/**/*'],
tasks: ['images']
}
}
});
// Load our modules...
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
// Build process...
grunt.registerTask('scripts', ['jshint', 'concat:scripts', 'uglify']);
grunt.registerTask('styles', ['sass', 'concat:styles', 'cssmin']);
grunt.registerTask('images', ['imagemin']);
grunt.registerTask('partials', ['htmlmin:partials']);
grunt.registerTask('index', ['htmlmin:index']);
// Default...
grunt.registerTask('default', ['index', 'styles', 'scripts', 'images', 'partials', 'clean']);
};