"use strict";

const gulp        = require("gulp");
const path        = require("path");
const mergeTasks  = require("merge2");
const sass        = require('gulp-sass');
const gutil       = require("gulp-util");
const minifyJs    = require("gulp-uglify");
const rename      = require("gulp-rename");
const concat      = require("gulp-concat");
const gulpForeach = require('gulp-foreach');
const webpack     = require('webpack-stream');
const minifyCss   = require("gulp-clean-css");
const ts          = require("gulp-typescript");
const autoprefix  = require("gulp-autoprefixer");
const server      = require("gulp-develop-server");
const map         = require("lodash").map;
const merge       = require("lodash").merge;

//Tasks
const tsTask = require("./gulp/typescript");
const sassTask = require("./gulp/sass");

gulp.task("sass", () =>
{
    return sassTask.task(gulp.src(sassTask.files));
})

gulp.task("ts:server", () =>
{
    return tsTask.task("server", gulp.src(tsTask.serverFiles));
});

gulp.task("ts:browser", () =>
{
    return tsTask.task("browser", gulp.src(tsTask.browserFiles));
})

gulp.task("ts", ["ts:server", "ts:browser"]);

gulp.task("default", ["ts", "sass"]);

gulp.task("watch", ["default"], (cb) =>
{
    server.listen({path: "bin/server.js"});
    
    gulp.watch(["bin/**/*.js", "gearworks.private.json"], server.restart);
    
    gulp.watch(sassTask.files, (event) =>
    {
        console.log('Sass file ' + event.path + ' was changed.');
        
        if (event.path.indexOf("_variables.scss") > -1)
        {
            //Recompile all sass files with updated variables.
            return sassTask.task(gulp.src(sassFiles));
        }
        
        return sassTask.task(gulp.src(event.path));
    })
    
    gulp.watch(tsTask.serverFiles, (event) =>
    {
        console.log(`TS server file ${event.path} changed.`)
        
        return tsTask.task("server", gulp.src(event.path), event.path);
    })
    
    gulp.watch(tsTask.browserFiles, (event) =>
    {
        console.log(`TS browser file ${event.path} changed.`)
        
        return tsTask.task("browser", gulp.src(event.path), event.path);
    })
})
@@ -55,669 +55,52 @@
 nst 
-path        = require(%22path%22);%0Aconst mergeTasks  = require(%22merge2%22);%0Aconst sass        = require('gulp-sass');%0Aconst gutil       = require(%22gulp-util%22);%0Aconst minifyJs    = require(%22gulp-uglify%22);%0Aconst rename      = require(%22gulp-rename%22);%0Aconst concat      = require(%22gulp-concat%22);%0Aconst gulpForeach = require('gulp-foreach');%0Aconst webpack     = require('webpack-stream');%0Aconst minifyCss   = require(%22gulp-clean-css%22);%0Aconst ts          = require(%22gulp-typescript%22);%0Aconst autoprefix  = require(%22gulp-autoprefixer%22);%0Aconst server      = require(%22gulp-develop-server%22);%0Aconst map         = require(%22lodash%22).map;%0Aconst merge       = require(%22lodash%22).merge
+server      = require(%22gulp-develop-server%22)
 ;%0A%0A/

Remove cruft from base gulpfile