2022-11-14 00:02:29 +00:00
|
|
|
const { src, dest, watch } = require("gulp");
|
|
|
|
const sass = require("gulp-sass")(require("sass"));
|
|
|
|
const browserify = require("browserify");
|
|
|
|
const source = require("vinyl-source-stream");
|
|
|
|
const uglify = require("gulp-uglify");
|
|
|
|
const buffer = require("vinyl-buffer");
|
2022-11-12 17:45:45 +00:00
|
|
|
|
|
|
|
function styles() {
|
2022-11-14 00:02:29 +00:00
|
|
|
return src("src/styles/main.scss")
|
|
|
|
.pipe(sass({ outputStyle: "compressed" }).on("error", sass.logError))
|
|
|
|
.pipe(dest("dist"));
|
|
|
|
}
|
|
|
|
|
|
|
|
function scripts() {
|
|
|
|
return browserify("src/scripts/app.js")
|
|
|
|
.transform("babelify", { presets: ["@babel/preset-env"] })
|
|
|
|
.bundle()
|
|
|
|
.pipe(source("bundle.js"))
|
|
|
|
.pipe(buffer())
|
|
|
|
.pipe(uglify())
|
|
|
|
.pipe(dest("dist"));
|
2022-11-12 17:45:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function sentinel() {
|
2022-11-14 00:02:29 +00:00
|
|
|
watch("src/styles/**/*.scss", { ignoreInitial: false }, styles);
|
|
|
|
watch("src/scripts/**/*.js", { ignoreInitial: false }, scripts);
|
2022-11-12 17:45:45 +00:00
|
|
|
}
|
|
|
|
|
2022-11-14 00:02:29 +00:00
|
|
|
exports.sentinel = sentinel;
|