-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
43 lines (38 loc) · 1.42 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
"use strict";
module.exports = function (grunt) {
// We need to include the core Moodle grunt file too, otherwise we can't run tasks like "amd".
// require("grunt-load-gruntfile")(grunt);
// grunt.loadGruntfile("../../Gruntfile.js");
// Load all grunt tasks.
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-clean");
var path = require('path');
var PWD = process.cwd();
grunt.initConfig({
watch: {
// If any .less file changes in directory "less" then run the "less" task.
files: "**/src/*.js",
tasks: ["uglify"]
},
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;
}
}
)
}
}
});
// The default task (running "grunt" in console).
grunt.registerTask("default", ["uglify"]);
};