-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
65 lines (55 loc) · 1.31 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
/* Importing modules */
const clean = require('gulp-clean');
const gulp = require('gulp');
const ts = require('gulp-typescript');
// Create tsProject
const tsProject = ts.createProject('tsconfig.json');
/**
* Task scripts
* This task compile typescript files to javascript
* Put the result in dist folder
*/
gulp.task('scripts', ['static'], () => {
const tsResult = tsProject.src()
.pipe(tsProject());
return tsResult.js
.pipe(gulp.dest('dist'));
});
/**
* Task static
* This task get json files changes
* Put the result in dist folder
*/
gulp.task('static', ['clean'], () => {
return gulp
.src(['src/**/*.json'])
.pipe(gulp.dest('dist'));
});
/**
* Task clean
* This task clean dist directory removing all files
*/
gulp.task('clean', () => {
return gulp
.src('dist')
.pipe(clean());
});
/**
* Task build
* This task clean dist directory, prepare static and scripts files
* And put result in dist directory
*/
gulp.task('build', ['scripts']);
/**
* Task watch
* This task watch change files in src directory, and run build
*/
gulp.task('watch', ['build'], () => {
return gulp
.watch(['src/**/*.ts', 'src/**/*.json'], ['build']);
});
/**
* Define default task
* Defining task watch as default and run just 'gulp' without pass params
*/
gulp.task('default', ['watch']);