-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
59 lines (49 loc) · 1.51 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
'use strict';
const gulp = require('gulp');
const pug = require('gulp-pug');
const notify = require('gulp-notify');
const ts = require('gulp-typescript');
// const server = require('gulp-develop-server');
const tsPath = ['./src/**/*.ts'];
const pugPath = ['./src/index.pug', './src/app/**/*.pug']
const jsPath = './dist/server/index.js';
const distPath = './dist';
gulp.task('build:dist', ['build:pug'], () => {
const tsProject = ts.createProject('./src/tsconfig.json');
const tsResult = gulp.src(tsPath)
.pipe(tsProject());
return tsResult.js
// .pipe(notify("Compilated JS files"))
.pipe(gulp.dest(distPath))
.pipe(notify({
message: "Generated file: <%= file.relative %> @ <%= options.date %>",
templateOptions: {
date: new Date()
}
}))
});
gulp.task('build:pug', (done) => {
gulp.src(pugPath)
.pipe(pug())
.pipe(gulp.dest(distPath))
.on('end', done);
});
gulp.task('watch', () => {
gulp.watch(tsPath, ['build:dist']);
});
/*
gulp.task('server:start', () => {
server.listen({ path: jsPath });
});
gulp.task('server:restart', () => {
server.restart((error) => {
if(error) {
console.error(error);
};
});
});
gulp.task('server:watch', ['server:start'], () => {
gulp.watch(tsPath, ['build:dist']);
gulp.watch(jsPath, ['server:restart'] );
});
*/