forked from nikospara/angular-require-lazy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
75 lines (72 loc) · 2.08 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
module.exports = function(grunt) {
var options = require("./build-scripts/options-grunt.js"),
config = require("./build-scripts/app.build-grunt.json");
grunt.initConfig({
instrument: {
sources: {
files: [{
expand: true,
cwd: "WebContent/",
src: ["scripts/app/**/*.js", "scripts/util/**/*.js"],
dest: "build-coverage/instrumented"
}],
options: {
baseline: "build-coverage/baseline.json"
}
}
},
copy: {
images: {
expand: true,
cwd: "WebContent/css/",
src: ["images/**"],
dest: "build/css/"
}
},
less: {
compile: {
options: {
yuicompress: true
},
files: {
"build/css/css/style.css": "WebContent/css/style.less"
}
}
},
require_lazy_grunt: {
options: {
buildOptions: options,
config: config,
callback: function(modules, pmresult) {
// This callback is optional; included here just for demonstration purposes.
var fs = require("fs"), util = require("util"), path = require("path");
fs.writeFileSync(path.join(options.outputBaseDir+"-stats", "modules.js"), "angular.module(\"app\").value(\"modules\"," + util.inspect(modules,{depth:null,colors:false}) + ");");
fs.writeFileSync(path.join(options.outputBaseDir+"-stats", "bundles.js"), "angular.module(\"app\").value(\"bundles\"," + util.inspect(pmresult.bundles,{depth:null,colors:false}) + ");");
}
}
},
karma: {
options: {
configFile: "karma.conf.js"
},
single: {
singleRun: true,
reporters: "dots"
},
coverage: {
singleRun: true,
configFile: "karma-coverage.conf.js"
}
},
clean: ["build/*","build-coverage/*"]
});
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-less");
grunt.loadNpmTasks("require-lazy-grunt");
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-karma");
grunt.loadTasks("build-scripts/grunt");
grunt.registerTask("default", ["less:compile","copy:images","require_lazy_grunt"]);
grunt.registerTask("test", ["karma:single"]);
grunt.registerTask("coverage", ["instrument","karma:coverage"]);
};