-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
82 lines (74 loc) · 2.25 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
76
77
78
79
80
81
82
module.exports = function (grunt) {
var shakaPlayerUrls = {
debug:
"https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.5.0/shaka-player.compiled.debug.js",
production:
"https://cdnjs.cloudflare.com/ajax/libs/shaka-player/4.5.0/shaka-player.compiled.js"
};
grunt.initConfig({
package: grunt.file.readJSON("package.json"),
clean: ["dist/*"],
copy: {
all: {
expand: true,
src: ["index.html"],
dest: "dist/",
flatten: true
}
},
concat: {
options: {},
dist: {
src: ["studiodrm.js"],
dest: "dist/studiodrm.js"
}
},
"string-replace": {
dist: {
files: [
{
src: "dist/index.html",
dest: "dist/index.html"
}
],
options: {
replacements: [
{
pattern: "{shaka}",
replacement: grunt.option("debug")
? shakaPlayerUrls.debug
: shakaPlayerUrls.production
},
{
pattern: "{studiodrmjs}",
replacement: "studiodrm.js"
}
]
}
}
},
connect: {
server: {
options: {
protocol: "https",
hostname: "shaka.studiodrm.local",
port: 14705,
base: "dist",
keepalive: true
}
}
}
});
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-string-replace");
grunt.loadNpmTasks("grunt-contrib-connect");
grunt.registerTask("build", [
"clean",
"copy",
"concat",
"string-replace"
]);
grunt.registerTask("serve", ["build", "connect"]);
};