ShatteredSword/gulpfile.js

39 lines
958 B
JavaScript
Raw Normal View History

2020-08-03 16:51:20 -04:00
var gulp = require('gulp');
2022-04-12 00:08:57 -04:00
const shell = require('gulp-shell');
2020-08-03 16:51:20 -04:00
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var watchify = require('watchify');
var tsify = require('tsify');
var fancy_log = require('fancy-log');
var paths = {
pages: ['src/*.html']
};
var watchedBrowserify = watchify(browserify({
basedir: '.',
debug: true,
entries: ['src/main.ts'],
cache: {},
packageCache: {}
}).plugin(tsify));
gulp.task('copy-html', function () {
return gulp.src(paths.pages)
.pipe(gulp.dest('dist'));
});
function bundle() {
return watchedBrowserify
.bundle()
.on('error', fancy_log)
.pipe(source('bundle.js'))
.pipe(gulp.dest('dist'));
}
gulp.task('default', gulp.series(gulp.parallel('copy-html'), bundle));
watchedBrowserify.on('update', bundle);
2022-04-12 00:08:57 -04:00
watchedBrowserify.on('log', fancy_log);
gulp.task('firebase', shell.task([
'firebase deploy'
]));