-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
45 lines (39 loc) · 1.28 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
// Gulp: Dependencies
var gulp = require('gulp');
var del = require('del');
var size = require('gulp-size');
var uglify = require('gulp-uglify');
var uglifycss = require('gulp-uglifycss');
// Watch files
function watchFiles() {
gulp.watch("./ressources/modifications/**/*.js", copyModificationScripts);
gulp.watch("./ressources/modifications/**/*.css", copyModificationStyles);
}
// Clean
function clean() {
return del(["./public/modifications"]);
}
// Modifications
function copyModificationScripts() {
return gulp
.src('ressources/modifications/**/*.js')
.pipe(uglify({mangle: false}))
.pipe(gulp.dest('public/modifications'))
.pipe(size({title: 'modScripts'}));
}
function copyModificationStyles() {
return gulp
.src('ressources/modifications/**/*.css')
.pipe(uglifycss())
.pipe(gulp.dest('public/modifications'))
.pipe(size({title: 'modStyles'}));
}
// Series tasks
const build = gulp.series(clean, gulp.parallel(copyModificationScripts, copyModificationStyles));
const watch = gulp.parallel(build, watchFiles);
// export tasks
exports.clean = clean;
exports.copyModificationScripts = copyModificationScripts;
exports.copyModificationStyles = copyModificationStyles;
exports.build = build;
exports.watch = watch;