forked from GuybrushGit/WarriorSim
-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
54 lines (49 loc) · 1.35 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
51
52
53
54
var gulp = require('gulp');
var cssnano = require('gulp-cssnano');
var sass = require('gulp-sass');
var minify = require('gulp-minify');
var rename = require('gulp-rename');
var stripCode = require('gulp-strip-code');
var browser = require('browser-sync').create();
gulp.task("js", function () {
return gulp
.src(["js/**/*.js", "lib/*.mjs"])
.pipe(rename(function (path) {
path.extname = ".min.js";
}))
.pipe(gulp.dest("dist/js"));
});
gulp.task("js-build", function () {
return gulp
.src(["js/**/*.js", "lib/*.mjs"])
// .pipe(stripCode({
// start_comment: "start-log",
// end_comment: "end-log"
// }))
.pipe(
minify({
noSource: true,
ext: {
min: ".min.js",
},
})
)
.pipe(gulp.dest("dist/js"));
});
gulp.task("sass", function () {
return gulp
.src("scss/style.scss")
.pipe(sass())
.pipe(cssnano())
.pipe(gulp.dest("dist/css"));
});
gulp.task("browser", function () {
browser.init({
server: {
baseDir: "./",
},
});
gulp.watch("scss/*.scss", gulp.series(["sass"]));
gulp.watch("js/**/*.js", gulp.series(["js"]));
});
gulp.task("default", gulp.series(["sass", "js", "browser"]));