"use strict";

var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var maps = require('gulp-sourcemaps');

var output_dir = 'public_html/scripts';

gulp.task('concatScripts', function(){
	return gulp.src(['js/story.js', 'js/comment.js', 'js/hn_util.js', 'js/stories_controller.js', 'js/comments_controller.js', 'js/settings.js', 'js/app.js'])
		.pipe(maps.init())
		.pipe(concat('app.js'))
		.pipe(maps.write('./'))
		.pipe(gulp.dest(output_dir));
});

gulp.task('minifyScripts', ['concatScripts'], function(){
	return gulp.src(output_dir + '/app.js')
		.pipe(uglify())
		.pipe(rename('app.min.js'))
		.pipe(gulp.dest(output_dir));
});
gulp.task('watchScripts', function(){
	gulp.watch('js/**/*.js', ['minifyScripts']);
});

gulp.task('build', ['minifyScripts']);
gulp.task('default', ['build']);

@@ -190,47 +190,399 @@
 ');%0A
-%0Avar output_dir = 'public_html/scripts'
+var sass = require('gulp-sass');%0A%0Avar JS_SOURCE_DIR = 'js/';%0Avar JS_DEST_DIR = 'public_html/scripts/';%0Avar DIST_NAME = 'app'; //name of compiled file to be served i.e. app.js and app.min.js%0A%0Avar SASS_SOURCE_DIR = 'sass/';%0Avar STYLES_DEST_DIR = 'public_html/styles/';%0Avar SASS_OPTIONS = %7B%0A  errLogToConsole: true,%0A  outputStyle: 'compressed' //options: expanded, nested, compact, compressed%0A%7D
 ;%0A%0Ag
@@ -642,60 +642,39 @@
 c(%5B'
-js/
 story
-.js
 ', '
-js/
 comment
-.js
 ', '
-js/
 hn_util
-.js
 ', '
-js/
 stor
@@ -687,26 +687,20 @@
 ntroller
-.js
 ', '
-js/
 comments
@@ -714,26 +714,20 @@
 ller
-.js
 ', '
-js/
 settings
 .js'
@@ -726,26 +726,75 @@
 ings
-.js
 ', '
-js/
 app
+'%5D.map(function(file)%7Breturn JS_SOURCE_DIR + file + '
 .js'
-%5D
+;%7D)
 )%0A%09%09
@@ -827,20 +827,29 @@
 (concat(
-'app
+DIST_NAME + '
 .js'))%0A%09
@@ -887,34 +887,35 @@
 e(gulp.dest(
-output_dir
+JS_DEST_DIR
 ));%0A%7D);%0A%0Agul
@@ -990,26 +990,35 @@
 src(
-output_dir + '/app
+JS_DEST_DIR + DIST_NAME + '
 .js'
@@ -1052,20 +1052,29 @@
 (rename(
-'app
+DIST_NAME + '
 .min.js'
@@ -1098,18 +1098,19 @@
 est(
-output_dir
+JS_DEST_DIR
 ));%0A
@@ -1163,20 +1163,33 @@
 p.watch(
-'js/
+JS_SOURCE_DIR + '
 **/*.js'
@@ -1207,32 +1207,312 @@
 cripts'%5D);%0A%7D);%0A%0A
+gulp.task('sass', function() %7B%0A    gulp.src(SASS_SOURCE_DIR + '**/*.scss')%0A        .pipe(sass(SASS_OPTIONS).on('error', sass.logError))%0A        .pipe(gulp.dest(STYLES_DEST_DIR));%0A%7D);%0Agulp.task('watchSass',function() %7B%0A    gulp.watch(SASS_SOURCE_DIR + '**/*.scss', %5B'sass'%5D);%0A%7D);%0A%0A
 gulp.task('build
@@ -1526,24 +1526,32 @@
 nifyScripts'
+, 'sass'
 %5D);%0Agulp.tas

add tasks to compile sass and fix bug where watchScripts task might be looking in the wrong directory