-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.main.js
102 lines (82 loc) · 2.41 KB
/
Gruntfile.main.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/**
* General Grunt setup: A sample
*/
"use strict";
var deepExtend = require("deep-extend");
/**
* Load configuration files for Grunt (Tasks)
* @param {string} path Path to folder with tasks
* @return {object} All options
*/
var loadTaskConfig = function (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;
};
/*
* Call Grunt configuration
*/
module.exports = function (grunt) {
// Measure time of grunt tasks
require("time-grunt")(grunt);
// Make Grunt accessible everwhere
process.grunt = grunt;
var config = deepExtend({
pkg: require("../../package")
}, loadTaskConfig("node_modules/build-config/tasks"));
// Load project configuration
grunt.initConfig(config);
// Load all npm tasks through jit-grunt (fetches all tasks from node_modules
// folder and custom extend object here)
require("jit-grunt")(grunt, {
configureProxies: "grunt-connect-proxy"
});
/**
* Development
*/
// Application server for local development, livereloading enabled
grunt.registerTask("server", ["configureProxies:server", "connect:server", "watch"]);
// Application server for local testing, livereloading disabled
grunt.registerTask("test", ["configureProxies:server", "connect:test"]);
// A task for development
grunt.registerTask("dev", [
// "jshint",
// "jscs",
"server"
]);
// A task for generating production code
grunt.registerTask("build", [
"clean:dist",
"gitinfo",
// "jshint",
// "jscs",
"requirejs:compile",
"cssmin",
"copy:dist",
"copy:distPortal"
]);
// a task for copying files for examples
grunt.registerTask("copyExamples", [
"clean:examples",
"copy:examples",
"copy:examplesInternetServices",
"copy:examplesPortal",
"clean:woffs",
"compress:examples",
"compress:examplesVersion"
]);
// a task for generating examples
grunt.registerTask("buildExamples", [
"build",
"copyExamples"
]);
// jsdoc Task
grunt.registerTask("doc", ["jsdoc"]);
// Default Task
grunt.registerTask("default", ["dev"]);
};