forked from ruhley/angular-color-picker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
46 lines (39 loc) · 1.57 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
(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.dev %>'
var gruntConfig = {config: {
// folders
lib: 'lib',
tests: 'tests',
grunt: 'grunt',
scripts: 'scripts',
styles: 'styles',
// misc
filename: 'angularjs-color-picker',
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);