-
Notifications
You must be signed in to change notification settings - Fork 8
/
Gruntfile.js
46 lines (34 loc) · 1005 Bytes
/
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
/*
* Author: Ian Paterson
* Grunt Commands
*/
'use strict';
var grunt = require('grunt');
// Creates an object with keys representing each file in the path assigned to
// the exported value of the file's module.
function loadConfig(path) {
var object = {};
var key;
grunt.file.expand({ cwd: path + '/' }, '*.{js,txt}').forEach(function(filename) {
key = filename.replace(/\.[^.]+$/,'');
if (filename.indexOf('.txt') >= 0) {
object[key] = grunt.file.read(path + '/' + filename);
}
else {
object[key] = require(path + '/' + filename);
}
});
return object;
}
module.exports = function(grunt) {
// Load grunt tasks automatically
// No need for grunt.loadNpmTasks('some-package');
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
// Load custom tasks
grunt.loadTasks('./tasks');
var config = loadConfig('./tasks/options');
grunt.initConfig(config);
console.log(grunt.config());
};