This repository has been archived by the owner on Apr 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
57 lines (49 loc) · 1.98 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
53
54
55
56
57
'use strict';
module.exports = function(grunt) {
// Init Grunt plugins
require('time-grunt')(grunt);
require('jit-grunt')(grunt, {
'express': 'grunt-express-server'
});
// Vars
var _ = require('lodash'),
// remapify = require('remapify'),
path = require('path'),
taskFiles = grunt.file.expand('config/*.yaml'), // Load all configuration in config/
userConfig = grunt.file.readYAML('config.yaml'), // Load user configuration
packageInfo = grunt.file.readJSON('package.json'), // Load package info
// Global configuration
globalConfig = {
cfg: userConfig,
pkg: packageInfo,
meta: {
banner:
'/**\n' +
' * <%= pkg.name %> - v<%= pkg.version %> - built <%= grunt.template.today("yyyy-mm-dd") %>\n' +
' * <%= pkg.homepage %>\n' +
' *\n' +
' * Made with love by <%= pkg.author %>\n' +
' * Licensed <%= pkg.license %>\n' +
' */\n'
}
};
// Show infos
grunt.log.writeln(grunt.template.process(globalConfig.meta.banner, {data: globalConfig}));
// Load all configurations for our tasks
grunt.verbose.subhead('Task Configuration:');
_.each(taskFiles, function (file) {
var taskName = path.basename(file, '.yaml'),
taskCont = grunt.file.readYAML(file);
grunt.verbose.ok('Reading task configuration: ' + taskName);
globalConfig[taskName] = taskCont;
});
// Init configuration
grunt.config.init(globalConfig);
// Load all tasks in ./tasks
grunt.task.loadTasks('tasks');
// Register default task (the other tasks are in ./tasks)
grunt.registerTask('default', 'The default task: build sources', function() {
grunt.log.writeln('Currently running the "default" task.');
grunt.task.run('clean:build', 'build', 'express:dev', 'open:dev', 'watch');
});
};