forked from TutorFast/TutorFast-Backend
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.babel.js
More file actions
51 lines (42 loc) · 944 Bytes
/
gulpfile.babel.js
File metadata and controls
51 lines (42 loc) · 944 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
39
40
41
42
43
44
45
46
47
48
49
50
51
import gulp from 'gulp';
import babel from 'gulp-babel';
import uglify from 'gulp-uglify';
import newer from 'gulp-newer';
import del from 'del';
import nodemon from 'gulp-nodemon';
import { join } from 'path';
const paths = {
scripts: {
src: join('src', '**', '*.js'),
dest: join('lib'),
},
};
export function scripts() {
return gulp.src(paths.scripts.src, { sourcemaps: true })
.pipe(newer(paths.scripts.dest))
.pipe(babel())
.pipe(uglify())
.pipe(gulp.dest(paths.scripts.dest));
}
const clean = () => del(['lib']);
export { clean };
export function watchScripts() {
return gulp.watch(paths.scripts.src, scripts);
}
export function watchLib(done) {
nodemon({
script: 'lib',
watch: 'lib/',
});
done();
}
export const build = gulp.series(clean, scripts);
export const dev =
gulp.series(
build,
gulp.parallel(
watchScripts,
watchLib,
),
);
export default build;