From b647296f084d067f3388bc9e3ce962c61e907cb8 Mon Sep 17 00:00:00 2001 From: mattx Date: Sun, 21 Jun 2020 15:07:31 +0200 Subject: [PATCH] Get build system working --- .gitignore | 2 ++ gulpfile.js | 31 +++++++++++++++++++++++++++++++ package.json | 2 ++ 3 files changed, 35 insertions(+) create mode 100644 gulpfile.js diff --git a/.gitignore b/.gitignore index 144585f..dbc8c6f 100644 --- a/.gitignore +++ b/.gitignore @@ -76,3 +76,5 @@ typings/ # FuseBox cache .fusebox/ +# Gulp build output +build/ diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..0c7abac --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,31 @@ +var gulp = require("gulp"); +var clean = require("gulp-clean"); +var coffee = require("gulp-coffee"); + +// gulp-clean seems to not like exporting the function +gulp.task("clean", function(){ + return gulp.src("./build", {read: false, allowEmpty: true}) + .pipe(clean()); +}); + +function server(cb){ + gulp.src("./index.coffee") + .pipe(coffee({bare: true})) + .pipe(gulp.dest("./build")); + cb(); +} + +function client(cb){ + gulp.src("./static/app.coffee") + .pipe(coffee({bare: true})) + .pipe(gulp.dest("./build/static")); + gulp.src("./static/index.html") + .pipe(gulp.dest("./build/static")); + cb(); +} + + + +exports.server = server; +exports.client = client; +exports.default = gulp.series("clean", gulp.parallel(server, client)); diff --git a/package.json b/package.json index d21e3fe..7f2c3a1 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,8 @@ "devDependencies": { "coffeescript": "^2.5.1", "gulp": "^4.0.2", + "gulp-clean": "^0.4.0", + "gulp-coffee": "^3.0.3", "stylus": "^0.54.7" } }