-
-
Notifications
You must be signed in to change notification settings - Fork 242
/
Copy pathgulpfile.js
50 lines (44 loc) · 1.11 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
const browsersync = require('browser-sync').create();
const concat = require('gulp-concat');
const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');
const uglify = require('gulp-uglify');
const paths = {
jsdev: [
'./javascripts-dev/vendor/jszip.js',
'./javascripts-dev/vendor/jszip-utils.js',
'./javascripts-dev/vendor/FileSaver.js',
'./javascripts-dev/src/downloader.js',
'./javascripts-dev/src/zipper.js',
'./javascripts-dev/src/ui.js',
'./javascripts-dev/main.js',
],
jsdist: './javascripts/',
};
function js() {
return gulp
.src(paths.jsdev)
.pipe(sourcemaps.init())
.pipe(concat('downloader-bundle.js'))
.pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(paths.jsdist));
}
function watch() {
gulp.watch(paths.jsdev, js);
}
function server() {
browsersync.init({
server: {
baseDir: './',
routes: {
"/test": 'javascripts-dev',
},
},
port: 4000,
notify: false,
open: false,
});
}
const build = gulp.series(js, gulp.parallel(watch, server));
gulp.task('default', build);