forked from yanivnizan/gamegear.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
80 lines (67 loc) · 2.37 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
// Generated on 2015-04-10 using generator-yeogurt 0.14.4
'use strict';
// Folder paths for:
// - dev (location for development source files)
// - tmp (location for files created when running 'grunt serve')
// - dist (location for files created when running 'grunt' or 'grunt build')
// - server (location for files pertaining to server folder)
var config = {
client: 'client',
tmp: '.tmp',
dist: 'dist',
server: 'server'
};
module.exports = function(grunt) {
// setup configuration object
grunt.config.set('yeogurt', config);
// show elapsed time at the end
require('time-grunt')(grunt);
// Load all grunt tasks with JIT (Makes task loading super fast!)
require('jit-grunt')(grunt, {
// translate useminPrepare to use the 'grunt-usemin' plugin
useminPrepare: 'grunt-usemin',
// translate swig to use the 'grunt-wobble-swig' plugin
swig: 'grunt-swig-templates'
});
// Load the include-all library in order to require all of our grunt
// configurations and task registrations dynamically.
var includeAll = require('include-all');
// Loads Grunt configuration modules from the specified
// relative path. These modules should export a function
// that, when run, should either load/configure or register
// a Grunt task.
function loadTasks(relPath) {
return includeAll({
dirname: require('path').resolve(__dirname, relPath),
filter: /(.+)\.js$/
}) || {};
}
// Invokes the function from a Grunt configuration module with
// a single argument - the `grunt` object.
function invokeConfigFn(tasks) {
for (var taskName in tasks) {
if (tasks.hasOwnProperty(taskName)) {
tasks[taskName](grunt);
}
}
}
// Load task functions
var utilConfig = loadTasks('./grunt/config/util');
var compileConfig = loadTasks('./grunt/config/compile');
var optimizeConfig = loadTasks('./grunt/config/optimize');
var serverConfig = loadTasks('./grunt/config/server');
var registerDefinitions = loadTasks('./grunt/tasks');
// (ensure that a default task exists)
if (!registerDefinitions.default) {
registerDefinitions.
default = function(grunt) {
grunt.registerTask('default', []);
};
}
// Run task functions to configure Grunt.
invokeConfigFn(utilConfig);
invokeConfigFn(compileConfig);
invokeConfigFn(optimizeConfig);
invokeConfigFn(serverConfig);
invokeConfigFn(registerDefinitions);
};