aboutsummaryrefslogtreecommitdiff
path: root/gulpfile.js
diff options
context:
space:
mode:
authorIndrajith K L2018-08-12 02:37:22 +0530
committerIndrajith K L2018-08-12 02:37:22 +0530
commitddbf11efa3667f6db0f04e93e6ce8ddc17b73a52 (patch)
tree441d2ca965aefadd45181c25afb8b3d1426cf7e7 /gulpfile.js
downloadjs13kgames-template-ddbf11efa3667f6db0f04e93e6ce8ddc17b73a52.tar.gz
js13kgames-template-ddbf11efa3667f6db0f04e93e6ce8ddc17b73a52.tar.bz2
js13kgames-template-ddbf11efa3667f6db0f04e93e6ce8ddc17b73a52.zip
Initial Commmit:
Gulp Tasks for * Copy libs to public folder * Source Uglyfy + Copy * Zip
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/gulpfile.js b/gulpfile.js
new file mode 100644
index 0000000..68c26f3
--- /dev/null
+++ b/gulpfile.js
@@ -0,0 +1,56 @@
+'use strict';
+
+var gulp = require('gulp');
+var browserSync = require('browser-sync').create();
+var uglify = require('gulp-uglify');
+const zip = require('gulp-vinyl-zip').zip;
+var size = require('gulp-size');
+
+var libs = ['./node_modules/kontra/kontra.min.js', './node_modules/tinymusic/dist/TinyMusic.min.js'];
+var libFolder = 'libs/';
+var outputTemp = 'temp/';
+
+gulp.task('serve', ['copylibs'], function () {
+
+ browserSync.init({
+ server: './'
+ });
+
+ gulp.watch("./**/*.js", { cwd: './' },function(){
+ gulp.run('uglyfy_copy')
+ }).on('change', browserSync.reload);;
+ gulp.watch("./**/*.html", { cwd: './' }).on('change', browserSync.reload);
+
+ browserSync.watch()
+
+});
+
+gulp.task('uglyfy_copy', function () {
+ return gulp.src('src/js/*.js')
+ .pipe(uglify())
+ .pipe(gulp.dest('public/js'));
+
+});
+
+
+gulp.task('copylibs', function () {
+ return gulp
+ .src(libs)
+ .pipe(gulp.dest(libFolder))
+});
+
+gulp.task('zipFiles',['prepare_dist_folder'], function () {
+ return gulp.src('temp/**/*.*')
+ .pipe(zip('archive.zip'))
+ .pipe(gulp.dest('dist'))
+ .pipe(size({
+ title: '### Final Archive Size => '
+ }))
+
+});
+
+gulp.task('prepare_dist_folder', function () {
+ return gulp
+ .src(['libs/*','public/**/*.*','index.html'],{base: './'})
+ .pipe(gulp.dest(outputTemp))
+});