-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
66 lines (56 loc) · 1.7 KB
/
gulpfile.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
/**
* Gulp build script
*/
var gulp = require("gulp"),
plug = require("gulp-load-plugins")(),
del = require("del"),
config = require("config");
var ace_deps = [
"ace.js",
"mode-markdown.js"
];
// set ace theme
ace_deps.push("theme-" + config.ace.theme + ".js");
ace_deps = ace_deps.map(function (file) {
return "ace/build/src-noconflict/" + file;
});
gulp.task("clean", function (done) {
del(["build/*", "coverage/*"], done);
});
gulp.task("mace", function () {
return gulp.src("src/*.coffee")
.pipe(plug.replace("((\"monokai\"))", "\"" + config.ace.theme + "\""))
.pipe(plug.coffee())
.pipe(plug.concat("mace-core.js"))
.pipe(gulp.dest("build/deps"))
.pipe(plug.uglify({preserveComments: "some"}))
.pipe(plug.concat("mace-core.min.js"))
.pipe(gulp.dest("build/deps"));
});
gulp.task("ace", function () {
return gulp.src(ace_deps)
.pipe(plug.insert.append(";"))
.pipe(plug.uglify({preserveComments: function (node, comment) {
// check license comment
return !!~ comment.value.indexOf("license");
}}))
.pipe(plug.concat("ace.min.js"))
.pipe(gulp.dest("build/deps"));
});
gulp.task("marked", function () {
return gulp.src("node_modules/marked/lib/marked.js")
.pipe(plug.uglify({preserveComments: function (node, comment) {
// check license comment
return !!~ comment.value.indexOf("Licensed");
}}))
.pipe(plug.concat("marked.min.js"))
.pipe(gulp.dest("build/deps"));
});
gulp.task("concat", ["mace", "ace", "marked"], function () {
return gulp.src("build/deps/*.min.js")
.pipe(plug.concat("mace.min.js"))
.pipe(gulp.dest("build"));
});
gulp.task("default", ["clean"], function () {
gulp.start("concat");
});