-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
38 lines (33 loc) · 766 Bytes
/
gulpfile.js
File metadata and controls
38 lines (33 loc) · 766 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
const { src, dest, watch, series } = require('gulp');
const terser = require('gulp-terser');
const browsersync = require('browser-sync').create();
// JavaScript Task
function jsTask(){
return src('./src/*.js', { sourcemaps: true })
.pipe(terser())
.pipe(dest('dist', { sourcemaps: '.' }));
}
// Browsersync Tasks
function browsersyncServe(cb){
browsersync.init({
server: {
baseDir: '.'
}
});
cb();
}
function browsersyncReload(cb){
browsersync.reload();
cb();
}
// Watch Task
function watchTask(){
watch('*.html', browsersyncReload);
watch(['./src/', './config/', './services/', './ciphers/'], series(jsTask, browsersyncReload));
}
// Default Gulp task
exports.default = series(
jsTask,
browsersyncServe,
watchTask
);