monkeytype/gulpfile.js

47 lines
1.2 KiB
JavaScript
Raw Normal View History

const { task, src, dest, series, watch } = require("gulp");
const concat = require("gulp-concat");
const del = require("del");
const vinylPaths = require("vinyl-paths");
2020-11-02 14:53:20 +08:00
var sass = require("gulp-sass");
sass.compiler = require("dart-sass");
//the order of files is important
const gulpSrc = [
"./src/js/misc.js",
"./src/js/words.js",
"./src/js/layouts.js",
"./src/js/db.js",
"./src/js/userconfig.js",
"./src/js/commandline.js",
"./src/js/leaderboards.js",
"./src/js/settings.js",
"./src/js/account.js",
"./src/js/script.js",
];
task("cat", function () {
2020-11-02 19:19:24 +08:00
return src(gulpSrc).pipe(concat("monkeytype.js")).pipe(dest("./dist/js"));
});
2020-11-02 14:53:20 +08:00
task("sass", function () {
return src("./src/sass/*.scss")
2020-11-02 14:53:20 +08:00
.pipe(sass({ outputStyle: "compressed" }).on("error", sass.logError))
2020-11-02 19:19:24 +08:00
.pipe(dest("dist/css"));
2020-11-02 14:53:20 +08:00
});
2020-11-02 19:19:24 +08:00
task("static", function () {
2020-11-04 09:01:39 +08:00
return src("./static/**/*").pipe(dest("./dist/"));
});
task("clean", function () {
2020-11-02 19:19:24 +08:00
return src("./dist/", { allowEmpty: true }).pipe(vinylPaths(del));
});
task("compile", series("static", "sass", "cat"));
task("watch", function () {
2020-11-04 09:01:39 +08:00
watch(["./static/**/*", "./src/**/*"], series("compile"));
});
task("build", series("clean", "compile"));