-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
69 lines (56 loc) · 1.71 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
66
67
68
69
'use strict';
var os = require('os');
var gulp = require('gulp');
var open = require('gulp-open');
var webserver = require('gulp-webserver');
var serve = require('gulp-serve');
// Default usage:
// Open one file with default application
gulp.task('open', function(){
gulp.src('./index.html')
.pipe(open());
});
var browser = os.platform() === 'linux' ? 'google-chrome' : (
os.platform() === 'darwin' ? 'google chrome' : (
os.platform() === 'win32' ? 'firefox' : 'firefox'));
gulp.task('browser', function(cb){
// gulp.src('./*.html')
// .pipe(open({app: browser}, cb));
});
// Simple usage, no options.
// This will use the uri in the default browser
gulp.task('uri', function(){
// gulp.src('')
// .pipe(open({uri:'http://www.google.com'}));
});
// Open an URL in a given browser:
gulp.task('app', function(){
// var options = {
// uri: 'localhost:3000',
// app: 'firefox'
// };
// gulp.src('./index.html')
// .pipe(open(options));
});
// Run the task with gulp
/* Webserver task:
Firstly runs the resources task - which serves the UI5 library files via a separate server.
and then creates a webserver that serves the application, and opens it in a browser */
gulp.task('webserver', function() {
gulp.src('app')
.pipe(webserver({
livereload: true,
directoryListing: true,
open: true
}));
});
gulp.task('serve', serve('public'));
gulp.task('serve-build', serve(['public', 'build']));
gulp.task('serve-prod', serve({
root: ['public', 'build'],
port: 443,
middleware: function(req, res) {
// custom optional middleware
}
}));
gulp.task('default', ['open', 'uri', 'app', 'browser','webserver']);