Roll dice (eg Asphodice) and show outcomes https://rpg.bertieb.org/dice-roller/
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

gulpfile.js 2.6 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 browserifyOpts = {
  17. basedir: ".",
  18. debug: true,
  19. entries: paths.ts,
  20. cache: {},
  21. packageCache: {},
  22. }
  23. var browserifyBuildOpts = browserify(browserifyOpts);
  24. var browserifyWatchOpts = browserify(Object.assign({},browserifyOpts));
  25. function browserifyBuild() {
  26. return browserifyBuildOpts
  27. .plugin("tsify")
  28. .bundle()
  29. .pipe(source("bundle.js"))
  30. .pipe(gulp.dest("dist"));
  31. };
  32. var watchedBrowserify = watchify(browserifyWatchOpts).plugin("tsify");
  33. function watchedBundle() {
  34. return watchedBrowserify
  35. .bundle()
  36. .on("error", fancy_log)
  37. .pipe(source("bundle.js"))
  38. .pipe(gulp.dest("dist"));
  39. }
  40. // Non-injecting SASS
  41. gulp.task('sass-noninject', function() {
  42. return gulp.src("src/scss/*.scss")
  43. .pipe(sass())
  44. .pipe(gulp.dest("dist/"))
  45. });
  46. // Compile sass into CSS & auto-inject into browsers
  47. gulp.task('sass', function() {
  48. return gulp.src("src/scss/*.scss")
  49. .pipe(sass())
  50. .pipe(gulp.dest("dist/"))
  51. .pipe(browserSync.stream());
  52. });
  53. gulp.task("copy-html", function () {
  54. return gulp.src(paths.pages).pipe(gulp.dest("dist"));
  55. });
  56. /*
  57. * NB: removed pending "do we actually need it" check
  58. *
  59. gulp.task("copy-css", function () {
  60. return gulp.src(paths.css).pipe(gulp.dest("dist/css"));
  61. });
  62. */
  63. gulp.task("compile-ts", function () {
  64. return tsProject.src().pipe(tsProject()).js.pipe(gulp.dest("dist"));
  65. });
  66. // Build without watching
  67. gulp.task("build", gulp.series(
  68. gulp.parallel("copy-html", "sass-noninject"),
  69. browserifyBuild
  70. ));
  71. gulp.task("build-hs", gulp.parallel("copy-html", "sass"));
  72. // Static Server + compile ts + watch scss/html/css files
  73. gulp.task('serve', gulp.series("build-hs", watchedBundle, function() {
  74. browserSync.init({
  75. server: "./dist/"
  76. });
  77. gulp.watch("src/scss/*.scss", gulp.series('sass'));
  78. //gulp.watch("src/css/*.css").on('change', gulp.series("copy-css"));
  79. gulp.watch("src/html/*.html").on('change', gulp.series("copy-html"));
  80. gulp.watch("dist/*.html").on('change', browserSync.reload);
  81. gulp.watch("dist/*.js").on('change', browserSync.reload);
  82. }));
  83. gulp.task('default', gulp.series('serve'));
  84. watchedBrowserify.on("update", watchedBundle);
  85. watchedBrowserify.on("log", fancy_log);