-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
64 lines (51 loc) · 1.48 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
/*! *//*!
* ~~~~~~~~~~~~~~~~~~
* Yofinity - Ÿœfiî~î†Ú
* https://github.com/crewstyle/yohoho.yofinity
* ~~~~~~~~~~~~~~~~~~
* Copyright 20xx Achraf Chouk (http://github.com/crewstyle)
*/
module.exports = function (grunt){
//------ [CONFIGURATION] ------//
var Helpers = require('./tasks/helpers'),
filterAvailable = Helpers.filterAvailableTasks,
_ = grunt.util._,
path = require('path');
//read package
Helpers.pkg = require('./package.json');
//check time
if (Helpers.isPackageAvailable('time-grunt')) {
require('time-grunt')(grunt);
}
//loads task options from `tasks/options/` and tasks defined in `package.json`
var config = _.extend({},
require('load-grunt-config')(grunt, {
configPath: path.join(__dirname, 'tasks/options')
})
);
//loads tasks in `tasks`
grunt.loadTasks('tasks');
//set node environment
config.env = process.env;
//------ [TASKS REGISTRATION] ------//
//JShint validation
grunt.registerTask('test', 'Test JS files.', ['debug']);
grunt.registerTask('debug', filterAvailable([
'jshint:src'
]));
//Default task
grunt.registerTask('default', 'Build minified & production-ready files.', [
'cleanall',
'minify'
]);
//Clean distributed files
grunt.registerTask('cleanall', filterAvailable([
'clean:dist'
]));
//Minify and uglify files
grunt.registerTask('minify', filterAvailable([
'uglify:src'
]));
//------ [INITIALIZATION] ------//
grunt.initConfig(config);
};