This repository has been archived by the owner on Mar 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGruntfile.js
85 lines (74 loc) · 1.69 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
'use strict';
var path = require('path');
module.exports = function(grunt) {
// Load grunt tasks automatically
require('jit-grunt')(grunt, {
express: 'grunt-express-server',
useminPrepare: 'grunt-usemin',
ngtemplates: 'grunt-angular-templates',
});
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Load grunt-tasks
require('load-grunt-config')(grunt, {
// path to task.js files, defaults to grunt dir
configPath: path.join(process.cwd(), 'grunt-tasks'),
data: {
pkg: grunt.file.readJSON('package.json'),
app: {
port: process.env.PORT || 9000
}
},
});
// Used for delaying livereload until after server has restarted
grunt.registerTask('wait', function() {
grunt.log.ok('Waiting for server reload...');
var done = this.async();
setTimeout(function() {
grunt.log.writeln('Done waiting!');
done();
}, 1500);
});
grunt.registerTask('prepare', function() {
grunt.task.run([
'clean:server',
'env:all',
'injector:sass',
'newer:babel:client',
'sass',
'injector',
'postcss'
]);
});
grunt.registerTask('serve', function() {
grunt.task.run([
'prepare',
'express:dev',
'wait',
'open',
'watch'
]);
});
grunt.registerTask('build', [
'clean:dist',
'injector:sass',
'newer:babel:client',
'sass',
'imagemin',
'injector',
'useminPrepare',
'postcss',
'ngtemplates',
'concat',
'ngAnnotate',
'copy:dist',
'babel:server',
'cssmin',
'uglify',
'rev',
'usemin'
]);
grunt.registerTask('default', [
'serve'
]);
};