forked from IgniteUI/help-samples-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
52 lines (45 loc) · 1.64 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
var gulp = require("gulp"),
util = require("gulp-util"),
localize = require("./build/localizeFiles.js"),
updateResources = require("./build/updateResources.js"),
createFiddleFiles = require("./build/createFiddleFiles.js");
var version = util.env.version; //should be passed as --version ${TRAVIS_BRANCH}
var dist = "./dist",
copySrc = [
"./css/**/*",
"./js/**/*",
"./images/**/*",
"./data-files/**/*",
"./data-files-ja/**/*"
],
config = require("./build/config.json");
// Command line overrides:
if (util.env["ignite-ui"]) {
// Optional override for the Ignite UI source location, can be passed as --ignite-ui "http://<ignite-ui root>"
config.patterns["%%ignite-ui%%"] = util.env["ignite-ui"];
}
if (version) {
config.patterns["%%ignite-ui%%"] = config.patterns["%%ignite-ui%%"].replace("latest", "20" + version + "/latest");
} else {
version = "latest";
}
if (util.env["live-url"]) {
// Optional override for the live demo URL (without trailing slash). Warning: might be case-sensitive
config.liveUrl = util.env["live-url"].replace(/\/$/, "");
}
config.version = version.toString();
dist = dist + "/" + version;
gulp.task("process-files", function () {
console.log("Building samples for: ", version);
console.log("Ignite UI source root: ", config.patterns["%%ignite-ui%%"]);
console.log("Live URL base: ", config.liveUrl);
return gulp.src(["HTMLSamples/**/*.html"])
.pipe(localize(config))
.pipe(updateResources(config))
.pipe(createFiddleFiles(config))
.pipe(gulp.dest(dist));
});
gulp.task("build-samples", ["process-files"], function () {
return gulp.src(copySrc, { base: "./" })
.pipe(gulp.dest("./dist"));
});