-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
95 lines (92 loc) · 2.52 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
"use strict";
var gulp = require('gulp'),
browserSync = require('browser-sync'),
nodemon = require('gulp-nodemon'),
sassing = require('./gulp/sass'),
Injector = require('./gulp/inject'),
test = require('./gulp/test'),
GovUk = require('./gulp/govuk');
function serve() {
var options = {
script: 'index.js',
delayTime: 1,
env: {
PORT: 3080
},
watch: ['services/**/*.js', 'js/**/*.js', 'assets/**/*.js'
, 'routes/**/*.js', 'controllers/**/*.js', '*.js']
}
return nodemon(options)
.on('restart', function (ev) {
console.log('Restarting....');
setTimeout(function(){
browserSync.notify('reloading now ...');
browserSync.reload({stream : false});
},1000);
})
.on('start', function(){
console.log('*** nodemon started');
startBrowserSync();
})
};
function startBrowserSync(){
if (browerSync.active){
return;
}
//console.log('starting browser-sync on port '+ port);
var options = {
server: "./index",
proxy : 'localhost:3080' ,
port : 3000,
files : ['services/**/*.js', 'js/**/*.js', 'assets/**/*.js', 'views/**/*.*', 'index.js'
, 'routes/**/*.js', 'controllers/**/*.js', '*.js','css/**/*.css'],
ghostMode :{
clicks : true,
location : false,
forms : true,
scroll : true
},
injectChanges : true,
logFileChanges : true,
logPrefix : 'vacancy app',
notify : true,
reloadDelay : 1000
}
browserSync(options);
}
// tests
gulp.task('test-runmocha', test.runmocha);
gulp.task('watch-mocha', test.watchmocha);
// copy assets
gulp.task('copying', gulp.parallel(
GovUk.mustache,
GovUk.assets,
GovUk.js
), GovUk.sass);
// injecting assets
gulp.task('injecting', gulp
.series(
Injector.injectingassets,
Injector.assetsIntoTemplate
));
//gulp.task('browser', browser);
// transforming sass to css
gulp.task('sassing', gulp.parallel(
GovUk.sass,
GovUk.mustache
), sassing);
// serve run nodemon
gulp.task('serve', gulp.series(gulp.parallel(
GovUk.mustache,
GovUk.assets,
GovUk.js,
GovUk.sass
), sassing, Injector.injectingassets, serve));
// default
gulp.task('default', gulp.series(gulp.parallel(
GovUk.mustache,
GovUk.assets,
GovUk.js,
GovUk.sass
), sassing, Injector.injectingassets,
gulp.parallel(serve,test.watchmocha)));