-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
52 lines (40 loc) · 1.36 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
47
48
49
50
51
52
(function() {
'use strict';
module.exports = function(grunt) {
// Configure Grunt
var grunt_config = {
pkg: grunt.file.readJSON('package.json')
};
_LoadTasksIntoConfig(grunt_config, './tasks/options/');
grunt.initConfig(grunt_config);
// Load NPM plugin Grunt tasks
require('load-grunt-tasks')(grunt);
// Register custom tasks
grunt.registerTask('default', []);
// Dev tasks
grunt.registerTask('build:dev', [
'shell:check_data', 'compass:dev', 'requirejs:dev'
]);
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('test', ['lint', 'build:dev', 'jasmine']);
grunt.registerTask('dev', ['test']);
// Prod tasks
grunt.registerTask('build:prod', ['compass:prod', 'requirejs:prod']);
// Do a sanity check by running all dev commands first
grunt.registerTask('prod', ['test', 'build:prod']);
// Generate data
grunt.registerTask('build:data', ['shell:generate_data']);
};
return;
// Idea to load from multiple files is from this site:
// http://www.thomasboyt.com/2013/09/01/maintainable-grunt.html
function _LoadTasksIntoConfig(config, path) {
var glob = require('glob');
var key;
glob.sync('*', {cwd: path}).forEach(function(option) {
key = option.replace(/\.js$/,'');
config[key] = require(path + option);
});
return config;
}
})();