This repository was archived by the owner on Nov 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathGulpfile.js
54 lines (45 loc) · 1.62 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
/// <binding ProjectOpened='typescript:watch' />
var path = require("path");
var gulp = require("gulp");
var del = require("del");
var ts = require("gulp-typescript");
var sourcemaps = require("gulp-sourcemaps");
var concat = require("gulp-concat");
var config = require("./config");
// Create TypeScript project from tsconfig.json
var tsClientProject = ts.createProject("tsconfig.json", {
typescript: require("typescript")
});
// Cleanup by deleting target directory
gulp.task("clean", function () {
del.sync(path.join(config.APP_DIST, "**/*"));
});
// Compile the typescript files of the client app
gulp.task("clientApp", [], function () {
var tsResult = gulp.src(config.TS_SOURCES)
.pipe(ts(tsClientProject))
.pipe(gulp.dest(config.APP_DIST));
});
gulp.task("index", [], function () {
// Combine external scripts into single file
gulp.src(config.SCRIPT_DEPENDENCIES)
.pipe(sourcemaps.init())
.pipe(concat(config.SCRIPT_COMBINED))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(config.APP_DIST));
// Combine external styles into single file
gulp.src(config.STYLES_DEPENDENCIES)
.pipe(sourcemaps.init())
.pipe(concat(config.STYLES_COMBINED))
.pipe(sourcemaps.write("."))
.pipe(gulp.dest(config.APP_DIST));
// Copy all HTML files
gulp.src(path.join(config.APP_SRC, "**/*.html"))
.pipe(gulp.dest(config.APP_DIST));
});
//Set a default tasks
gulp.task("default", ["clean", "clientApp", "index"], function () { });
// Define a watch task
gulp.task("watch", function () {
gulp.watch(path.join(config.APP_SRC, "**/*"), ["default"]);
});