// to run tasks, do Ctrl+Shift+B

var outputFileName = "index.js";
var debugDirName = "./output/debug/";
var releaseDirName = "./output/release/";
var wrappedDirName = "./wrapped/";
var binaryDirName = "./bin/";
var gulp = require('gulp');



var del = require("del");
gulp.task('clean_all', function (cb) {
	del([
		'./output/**/*'
	], cb);
});
gulp.task('clean_debug', function (cb) {
	del([
		'./output/debug/**/*'
	], cb);
});
gulp.task('clean_release', function (cb) {
	del([
		'./output/release/**/*'
	], cb);
});



var pug = require('gulp-pug');
gulp.task('pug', function () {
	var option = { pretty: true }
	gulp.src([
		'./src/**/*.pug',
		'!./node_modules/**'
	]).pipe(plumber())
		.pipe(pug(option))
		.pipe(gulp.dest('./output/debug'));
});



var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var plumber = require('gulp-plumber');  // error handling
gulp.task('sass', function () {
	gulp.src([
		'./src/**/*.scss',
		'!./node_modules/**'    // except files below node_modules folder
	]).pipe(plumber())
		.pipe(sass())
		.pipe(autoprefixer())
		.pipe(gulp.dest('./output/debug/css'));
});



var typescript = require('gulp-typescript');
gulp.task('ts', function () {
	gulp.src([
		'./src/ts/**/*.ts',
		'!./node_modules/**'    // except files below node_modules folder
	]).pipe(typescript())
		.pipe(gulp.dest('./output/debug/js'));
});


var open = require("gulp-open");
gulp.task("test", ["rebuild_debug"], function () {
	gulp.src("./index-debug.html").pipe(open());
});



var insert = require("gulp-insert");
var minify = require("gulp-closurecompiler");
gulp.task("release", ["rebuild_debug"], function () {
	return gulp.
		src(debugDirName + outputFileName)
		.pipe(newer(releaseDirName))
		.pipe(insert.wrap("(function() {\nvar NDEBUG=true;\n", "\n})();"))
		.pipe(gulp.dest(wrappedDirName))
		.pipe(minify({ fileName: outputFileName }))
		.pipe(gulp.dest(releaseDirName));
});



gulp.task('rebuild_debug', function () {
	gulp.start('clean_debug');
	gulp.start('pug');
	gulp.start('sass');
	gulp.start('ts');
});

@@ -27,16 +27,45 @@
 hift+B%0A%0A
+var sourceDirName = %22./src%22;%0A
 var outp
@@ -89,16 +89,48 @@
 ex.js%22;%0A
+var outputDirName = %22./output%22;%0A
 var debu
@@ -155,17 +155,16 @@
 ut/debug
-/
 %22;%0Avar r
@@ -196,17 +196,16 @@
 /release
-/
 %22;%0Avar w
@@ -292,16 +292,44 @@
 gulp');%0A
+var path = require('path');%0A
 %0A%0A%0Avar d
@@ -401,23 +401,40 @@
 %5B%0A%09%09
-'./output/
+path.join(outputDirName, '
 **/*'
+)
 %0A%09%5D,
@@ -497,29 +497,39 @@
 %5B%0A%09%09
-'./output/debug/
+path.join(debugDirName, '
 **/*'
+)
 %0A%09%5D,
@@ -594,31 +594,41 @@
 %5B%0A%09%09
-'./output/release/
+path.join(releaseDirName, '
 **/*'
+)
 %0A%09%5D,
@@ -743,31 +743,50 @@
 ulp.src(%5B%0A%09%09
-'./src/
+path.join(sourceDirName, '
 **/*.pug',%0A%09
@@ -782,16 +782,17 @@
 */*.pug'
+)
 ,%0A%09%09'!./
@@ -871,24 +871,20 @@
 est(
-'./output/debug'
+debugDirName
 ));%0A
@@ -1076,23 +1076,42 @@
 src(%5B%0A%09%09
-'./src/
+path.join(sourceDirName, '
 **/*.scs
@@ -1112,16 +1112,17 @@
 /*.scss'
+)
 ,%0A%09%09'!./
@@ -1265,30 +1265,40 @@
 est(
-'./output/debug/
+path.join(debugDirName, '
 css'))
+)
 ;%0A%7D)
@@ -1395,15 +1395,34 @@
 %5B%0A%09%09
-'./src/
+path.join(sourceDirName, '
 ts/*
@@ -1428,16 +1428,17 @@
 **/*.ts'
+)
 ,%0A%09%09'!./
@@ -1544,29 +1544,39 @@
 est(
-'./output/debug/
+path.join(debugDirName, '
 js'))
+)
 ;%0A%7D)
@@ -1873,16 +1873,26 @@
 .%0A%09%09src(
+path.join(
 debugDir
@@ -1899,10 +1899,9 @@
 Name
- +
+,
  out
@@ -1912,16 +1912,17 @@
 ileName)
+)
 %0A%09%09.pipe

update file path settings in gulpfile.js