-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgrunt-util.js
34 lines (33 loc) · 1.06 KB
/
grunt-util.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
'use strict';
module.exports = function(grunt) {
var fs = require('fs');
var pkg = grunt.file.readJSON('package.json');
grunt.util._.extend(grunt, {
loadConfigs: function(path) {
var config = {
pkg: pkg
};
grunt.util._.forEach(fs.readdirSync(path), function(file) {
grunt.util._.merge(config, require('../../' + path + '/' + file)(grunt));
});
return config;
}
});
grunt.util._.extend(grunt.file, {
changed: function(filepath) {
return fs.statSync(filepath).mtime.getTime() > Date.now() - 60000;
}
});
grunt.util._.each(pkg.dependencies, function(val, key) {
if (key === 'grunt-util') return true;
if (key === 'grunt-template-jasmine-requirejs') return true;
if (key.substring( 0, 6 ) === 'grunt-') grunt.loadNpmTasks( key );
});
if (typeof grunt.option('production') === 'undefined') {
grunt.util._.each(pkg.devDependencies, function(val, key) {
if (key === 'grunt-util') return true;
if (key === 'grunt-template-jasmine-requirejs') return true;
if (key.substring( 0, 6 ) === 'grunt-') grunt.loadNpmTasks( key );
});
}
}