forked from sebwal/SWE
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
executable file
·63 lines (59 loc) · 1.65 KB
/
gulpfile.js
File metadata and controls
executable file
·63 lines (59 loc) · 1.65 KB
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
'use strict';
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; //don't know what this is supposed to do...
var gulp = require('gulp'),
webserver = require('gulp-webserver'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
watch = require('gulp-watch'),
tsc = require('gulp-typescript'),
jshint = require('gulp-jshint');
//runs webserver
gulp.task('webserver', function(){
gulp.src('.')
.pipe(webserver({
port: 1337,
open: 'http://localhost:1337/src',
livereload: {
enable: true
},
//workaround
proxies: [
{
source: "/rest",
target: "https://localhost:8443/shop/rest"
}
]
}));
});
//compiles the .ts files to app.js
gulp.task('tsc', function(){
gulp.src('./src/**/*.ts')
.pipe(tsc({
out: 'app.js'
}))
.pipe(gulp.dest('./src/components/base/app'));
});
//uglifies app.js into app.min.js
gulp.task('uglify', function(){
gulp.src('./src/**/*.ts')
.pipe(tsc({
out: 'app.js'
}))
.pipe(uglify())
.pipe(concat('app.min.js'))
.pipe(gulp.dest('./src/components/base/app'));
});
//
gulp.task('jshint', function(){
return gulp.src('./src/components/base/app/app.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
//runs the specified tasks whenever a change in the src folder is made (and saved)
gulp.watch('./src/**/*.ts', function(){
gulp.run('tsc');
gulp.run('uglify');
gulp.run('jshint');
});
//this defines the tasks that are run when the command '>gulp' is executed in command prompt
gulp.task('default', ['uglify', 'tsc', 'jshint','webserver']);