This repository has been archived by the owner on Jul 9, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
81 lines (71 loc) · 2.33 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
70
71
72
73
74
75
76
77
78
79
80
81
/*
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
'use strict';
// Include Gulp & tools we"ll use
var gulp = require('gulp');
var browsersync = require('browser-sync');
var browsersyncConfig = {
open: "external",
startPath: "/uqlibrary-training/demo/index.html",
host: "dev-app.library.uq.edu.au",
port: 5000,
server: {
baseDir: ["../"]
},
files: [
"elements/*.html",
"elements/*.js"
]
};
// Watch files for changes & reload
gulp.task('serve', function (done) {
console.log("Running server...");
browsersync(browsersyncConfig);
done();
});
// Watch files for changes & reload
gulp.task('serve-compact', function (done) {
console.log('Running server...');
browsersyncConfig.startPath = '/uqlibrary-training/demo/index-compact.html';
browsersync(browsersyncConfig);
done();
});
var cookieToggle = [
{
match: /(document\.cookie="UQLMockData(-PType)?=[^;])/g,
replace: '// $1'
},
{
match: /\/\/ (document\.cookie="UQLMockData(-PType)?=;)/g,
replace: "$1"
}
];
// Run the server, but comment out the mock data cookies
// Note: For some reason it often requires a manual hard browser refresh
// to switch from normal serving to this mode
gulp.task('live', function (done) {
console.log('Running demonstration server...');
browsersyncConfig.rewriteRules = cookieToggle;
browsersync(browsersyncConfig);
done();
});
gulp.task('live-compact', function (done) {
console.log('Running demonstration server...');
browsersyncConfig.startPath = '/uqlibrary-training/demo/index-compact.html';
browsersyncConfig.rewriteRules = cookieToggle;
browsersync(browsersyncConfig);
done();
});
// Build production files, the default task
gulp.task('default', gulp.series('serve', function (done) {
done();
}));
// Load tasks for web-component-tester
// Adds tasks for `gulp test:local` and `gulp test:remote`
require('web-component-tester').gulp.init(gulp);