Roll dice (eg Asphodice) and show outcomes https://rpg.bertieb.org/dice-roller/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

gulpfile.js 2.1 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. let gulp = require("gulp");
  2. let browserSync = require("browser-sync").create();
  3. let sass = require("gulp-sass");
  4. var ts = require("gulp-typescript");
  5. var tsProject = ts.createProject("tsconfig.json");
  6. var browserify = require("browserify");
  7. var source = require("vinyl-source-stream");
  8. var tsify = require("tsify");
  9. var watchify = require("watchify");
  10. var fancy_log = require("fancy-log");
  11. var paths = {
  12. pages: ["src/html/*.html"],
  13. css: ["src/css/*.css"],
  14. ts: ["src/ts/frontend.ts"],
  15. };
  16. var watchedBrowserify = watchify(
  17. browserify({
  18. basedir: ".",
  19. debug: true,
  20. entries: paths.ts,
  21. cache: {},
  22. packageCache: {},
  23. }).plugin(tsify)
  24. );
  25. function bundle() {
  26. return watchedBrowserify
  27. .bundle()
  28. .on("error", fancy_log)
  29. .pipe(source("bundle.js"))
  30. .pipe(gulp.dest("dist"));
  31. }
  32. // Compile sass into CSS & auto-inject into browsers
  33. gulp.task('sass', function() {
  34. return gulp.src("src/scss/*.scss")
  35. .pipe(sass())
  36. .pipe(gulp.dest("dist/css"))
  37. .pipe(browserSync.stream());
  38. });
  39. gulp.task("copy-html", function () {
  40. return gulp.src(paths.pages).pipe(gulp.dest("dist"));
  41. });
  42. gulp.task("copy-css", function () {
  43. return gulp.src(paths.css).pipe(gulp.dest("dist/css"));
  44. });
  45. gulp.task("compile-ts", function () {
  46. return tsProject.src().pipe(tsProject()).js.pipe(gulp.dest("dist"));
  47. });
  48. gulp.task("build", gulp.parallel("copy-html", "copy-css", "compile-ts", "sass"));
  49. // Static Server + compile ts + watch scss/html/css files
  50. //gulp.task('serve', gulp.series("compile-ts", "browserify", 'sass', "copy-html", "copy-css", function() {
  51. gulp.task('serve', gulp.series("build", bundle, function() {
  52. browserSync.init({
  53. server: "./dist/"
  54. });
  55. gulp.watch("src/scss/*.scss", gulp.series('sass'));
  56. gulp.watch("src/css/*.css").on('change', gulp.series("copy-css"));
  57. gulp.watch("src/html/*.html").on('change', gulp.series("copy-html"));
  58. gulp.watch("dist/*.html").on('change', browserSync.reload);
  59. gulp.watch("dist/*.js").on('change', browserSync.reload);
  60. }));
  61. gulp.task('default', gulp.series('serve'));
  62. watchedBrowserify.on("update", bundle);
  63. watchedBrowserify.on("log", fancy_log);