-
Notifications
You must be signed in to change notification settings - Fork 43
Expand file tree
/
Copy pathGruntfile.js
More file actions
25 lines (21 loc) · 832 Bytes
/
Copy pathGruntfile.js
File metadata and controls
25 lines (21 loc) · 832 Bytes
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
module.exports = function(grunt) {
require("load-grunt-config")(grunt, {
data: {
srcDir: "src/javascripts",
buildDir: "dist/javascripts",
tempDir: "temp"
}
});
grunt.registerMultiTask("removeBlock", function() {
var removalRegEx = new RegExp("(\/\/ " + this.options()[0] + " \/\/)(?:[^])*?(\/\/ " + this.options()[1] + " \/\/)", "g");
this.data.files.forEach(function(fileObj){
var
sourceFile = grunt.file.read( fileObj.src ),
removedFile = sourceFile.replace( removalRegEx, "" ),
targetFile = grunt.file.write( fileObj.dest, removedFile );
});
});
grunt.registerTask("build", ["clean:dist", "clean:demo", "removeBlock", "uglify", "jade", "clean:temp"]);
grunt.registerTask("dev", ["build", "watch"]);
grunt.registerTask("default", "build");
};