-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
109 lines (85 loc) · 2.87 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) {
var Helpers = require('./tasks/helpers'),
filterAvailable = Helpers.filterAvailableTasks,
_ = grunt.util._;
Helpers.pkg = require("./package.json");
Helpers.embersmith = require("./embersmith.json");
if (Helpers.isPackageAvailable("time-grunt")) {
require("time-grunt")(grunt);
}
// Loads task options from `tasks/options/`
// and loads tasks defined in `package.json`
var config = require('load-grunt-config')(grunt, {
configPath: "tasks/options",
init: false
});
grunt.loadTasks('tasks'); // Loads tasks in `tasks/` folder
config.env = process.env;
// Generate the production version
// ------------------
grunt.registerTask('dist', "Build a minified & production-ready version of your app.", [
'clean:dist', 'build:dist', 'copy:assemble', 'optimize' ]);
// Default Task
// ------------------
grunt.registerTask('default', "Start server.", ['server']);
// Servers
// -------------------
grunt.registerTask('server', "Run your server in development mode, auto-rebuilding when files change.", [
'clean:debug',
'build:debug',
'expressServer:debug',
'watch'
]);
grunt.registerTask('server:dist', "Build and preview a minified & production-ready version of your app.", [
'dist',
'expressServer:dist:keepalive'
]);
// Worker tasks
// =================================
grunt.registerTask('build:dist', [
'concurrent:dist', // Tasks are ran in parallel, see config below
]);
grunt.registerTask('build:debug', [
'concurrent:debug', // Tasks are ran in parallel, see config below
]);
grunt.registerTask('optimize', [
'useminPrepare',
'concat',
'uglify',
'copy:dist',
'rev',
'usemin'
]);
// Parallelize most of the build process
_.merge(config, {
concurrent: {
dist: [
"buildScripts",
"buildStyles",
"buildContents"
],
debug: [
"buildScripts",
"buildStyles",
"buildContents"
]
}
});
// Scripts
grunt.registerTask('buildScripts', filterAvailable([
'coffee',
'copy:javascriptToTmp',
'jshint'
]));
// Styles
grunt.registerTask('buildStyles', filterAvailable([
'less:compile',
'cssmin'
]));
// HTML
grunt.registerTask('buildContents', [
'embersmith:build',
'preprocess:HTML'
]);
grunt.initConfig(config);
};