-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgulpfile.js
33 lines (28 loc) · 961 Bytes
/
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
const gulp = require("gulp");
const { parallel, series } = require("gulp");
const uglify = require("gulp-uglify");
const concat = require("gulp-concat");
const browserSync = require("browser-sync").create(); //https://browsersync.io/docs/gulp#page-top
// Scripts
function js(cb) {
gulp.src("js/*js")
.pipe(concat("superformulasvg.min.js"))
.pipe(uglify())
.pipe(gulp.dest("dist"));
cb();
}
// Watch Files
function watch_files() {
browserSync.init({
server: {
baseDir: "./"
}
});
gulp.watch("js/*js", js).on("change", browserSync.reload);
gulp.watch("css/*css").on("change", browserSync.reload);
gulp.watch("index.html").on("change", browserSync.reload);
}
// Default 'gulp' command with start local server and watch files for changes.
exports.default = series(js, watch_files);
// 'gulp build' will build all assets but not run on a local server.
exports.build = parallel(js);