-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGruntfile.js
62 lines (49 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
/*! *//*!
* ~~~~~~~~~~~~~~~~~~
* Slyder - ∑¬Ú∂ê®
* https://github.com/crewstyle/yohoho.slyder
* ~~~~~~~~~~~~~~~~~~
* 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'
]));
//distributed task
grunt.registerTask('default', 'Build minified & production-ready files.', [
'cleany',
'minify'
]);
//clean folders
grunt.registerTask('cleany', filterAvailable(['clean:main']));
//minify and uglify files
grunt.registerTask('minify', filterAvailable([
'less:src',
'cssmin:main',
'uglify:src'
]));
//------ [INITIALIZATION] ------//
grunt.initConfig(config);
};