-
Notifications
You must be signed in to change notification settings - Fork 3
/
Gruntfile.js
53 lines (46 loc) · 1.7 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
/**
* Gruntfile for creating Asynchronous Module Definition JavaScript files in tool_supporter
* Changes: Removed unused tasks and some other code
*
* @package tool_supporter
* @author my-curiosity
* @author Based on code originally written by G J Barnard, Joby Harding, Bas Brands, David Scotson and many other contributors.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = function(grunt) {
var path = require("path");
var moodleroot = path.dirname(path.dirname(__dirname));
var dirrootopt = grunt.option("dirroot") || process.env.MOODLE_DIR || "";
if ("" !== dirrootopt) {
moodleroot = path.resolve(dirrootopt);
}
var PWD = process.cwd();
grunt.initConfig({
jshint: {
options: {
jshintrc: true
},
files: ["**/amd/src/*.js", '!**/amd/src/jquery.dataTables.js']
},
uglify: {
dynamic_mappings: {
files: grunt.file.expandMapping(
["**/src/*.js", "!**/node_modules/**"],
"",
{
cwd: PWD,
rename: function(destBase, destPath) {
destPath = destPath.replace("src", "build");
destPath = destPath.replace(".js", ".min.js");
destPath = path.resolve(PWD, destPath);
return destPath;
}
}
)
}
}
});
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.registerTask("amd", ["jshint", "uglify"]);
};