2013-09-13 13:52:13 -07:00
|
|
|
/* jshint node:true */
|
2013-07-20 14:56:59 -07:00
|
|
|
'use strict';
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
|
2013-09-13 13:52:13 -07:00
|
|
|
var config = {
|
2013-07-20 14:56:59 -07:00
|
|
|
pkg: grunt.file.readJSON('package.json'),
|
2013-11-14 21:29:41 -07:00
|
|
|
baseDir: '.',
|
2013-09-13 13:52:13 -07:00
|
|
|
srcDir: 'src',
|
|
|
|
destDir: 'dist',
|
|
|
|
tempDir: 'tmp',
|
2013-12-02 12:43:39 -07:00
|
|
|
docsDir: 'docs/'
|
2013-09-13 13:52:13 -07:00
|
|
|
};
|
|
|
|
|
2013-11-14 16:07:14 -07:00
|
|
|
// load plugins
|
|
|
|
require('load-grunt-tasks')(grunt);
|
2013-09-19 10:17:42 -07:00
|
|
|
|
2013-11-14 16:07:14 -07:00
|
|
|
// load task definitions
|
|
|
|
grunt.loadTasks('tasks');
|
2013-10-17 15:33:43 -07:00
|
|
|
|
2013-11-14 20:30:28 -07:00
|
|
|
// Utility function to load plugin settings into config
|
|
|
|
function loadConfig(config,path) {
|
2013-11-14 16:07:14 -07:00
|
|
|
require('glob').sync('*', {cwd: path}).forEach(function(option) {
|
2013-11-14 20:30:28 -07:00
|
|
|
var key = option.replace(/\.js$/,'');
|
|
|
|
// If key already exists, extend it. It is your responsibility to avoid naming collisions
|
|
|
|
config[key] = config[key] || {};
|
2013-11-15 09:44:06 -07:00
|
|
|
grunt.util._.extend(config[key], require(path + option)(config,grunt));
|
2013-09-19 10:17:42 -07:00
|
|
|
});
|
2013-11-14 20:30:28 -07:00
|
|
|
// technically not required
|
|
|
|
return config;
|
2013-11-14 16:07:14 -07:00
|
|
|
}
|
2013-09-19 13:45:09 -07:00
|
|
|
|
2013-11-14 16:07:14 -07:00
|
|
|
// Merge that object with what with whatever we have here
|
2013-11-14 20:30:28 -07:00
|
|
|
loadConfig(config,'./tasks/options/');
|
2013-09-19 10:17:42 -07:00
|
|
|
|
|
|
|
// pass the config to grunt
|
|
|
|
grunt.initConfig(config);
|
|
|
|
|
2013-08-26 17:44:02 -07:00
|
|
|
};
|