-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGulpfile.js
More file actions
41 lines (33 loc) · 943 Bytes
/
Gulpfile.js
File metadata and controls
41 lines (33 loc) · 943 Bytes
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
var gulp = require('gulp');
var connect = require('gulp-connect');
var webpack = require('webpack-stream');
var jsonServer = require("gulp-json-srv");
var server = jsonServer.create();
gulp.task("start", function(){
return gulp.src("data.json")
.pipe(server.pipe());
});
gulp.task('connect', ['copy'], function() {
connect.server({
root: ['./build'],
port: 3001
});
});
gulp.task('scripts', function() {
return gulp.src('./src/app.ts')
.pipe(webpack(require('./webpack.config.js')))
.pipe(gulp.dest('./build'))
;
});
gulp.task('copy', function() {
return gulp.src(['./src/**/**.*', '!./src/**/**.ts'], {
base: './src'
})
.pipe(gulp.dest('./build'))
;
});
gulp.task('build', ['scripts', 'copy']);
gulp.task('default', ['scripts', 'copy', 'connect', 'start'], function() {
gulp.watch(['!./src/**/**.ts', './src/**/**.*'], ['copy']);
gulp.watch('./src/**/**.ts', ['scripts']);
});