-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
45 lines (35 loc) · 1.05 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
'use strict';
module.exports = function(grunt) {
var path = require('path');
var appDir = path.dirname('./Gruntfile.js');
// Utility to load the different option files
// based on their names
function loadConfig(path) {
var glob = require('glob');
var object = {};
var key;
glob.sync('*', {cwd: path}).forEach(function(option) {
key = option.replace(/\.js$/,'');
object[key] = require(path + option);
});
return object;
}
// Initial config
var config = {
pkg: grunt.file.readJSON('package.json'),
paths: {
app: 'app',
dist: 'dist',
root: appDir
}
};
// Load tasks from the tasks folder
grunt.loadTasks('tasks');
// Load all the tasks options in tasks/options base on the name:
// watch.js => watch{}
grunt.util._.extend(config, loadConfig('./tasks/options/'));
grunt.initConfig(config);
require('load-grunt-tasks')(grunt);
// Default Task is basically a rebuild
grunt.registerTask('default', ['concat', 'uglify', 'sass', 'imagemin', 'autoprefixer', 'cssmin']);
};