forked from aidanmorgan/aus_suburb_kml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
38 lines (31 loc) · 1.31 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
(function(module) {
'use strict';
module.exports = function (grunt) {
// if this variable exists we have already set up grunt
if (!grunt || !grunt.config || !grunt.config.data || !grunt.config.data.config || !grunt.config.data.config.dev) {
// Load grunt modules from package.json automatically
require('load-grunt-tasks')(grunt);
// config variables, these are accessible like '<%= config.pkg %>'
var gruntConfig = {config: {
pkg: grunt.file.readJSON('package.json'),
}};
// loads tasks in the 'grunt' folder
grunt.loadTasks('grunt');
// loads task options in the 'grunt/options' folder
grunt.initConfig(grunt.util._.extend(gruntConfig, gruntLoadConfig('./grunt/options/', grunt)));
}
};
function gruntLoadConfig(path, grunt) {
var glob = require('glob');
var object = {};
var key;
glob.sync('*', {cwd: path}).forEach(function(option) {
key = option.replace(/\.js$/,'');
object[key] = require(process.cwd() + path.replace('.', '') + option);
if (typeof object[key] == 'function') {
object[key] = object[key](grunt);
}
});
return object;
}
})(module);