'use strict';

var gulp = require('gulp');
var slim = require('gulp-slim');
var rimraf = require('gulp-rimraf');
var sass = require('gulp-sass')
var coffee = require('gulp-coffee');
var gutil = require('gulp-util');
var bower = require('gulp-bower');

gulp.task('default', function() {
  // place code for your default task here
});

gulp.task('slim', ['slim-main', 'slim-partials']);
gulp.task('build', ['slim', 'coffee', 'sass']);

var path = {
  src: {
    slim: {
      main: './src/slim/*.slim',
      partials: './src/slim/partials/*.slim'
    },
    sass: './src/scss/*.scss',
    coffee: './src/coffee/*.coffee'
  },
  app: {
    html: {
      main: './www/',
      partials: './www/partials/'
    },
    css: './www/css/',
    js: './www/js/'
  },
  bower: './src/bower_components'
};

var cleanArr = [
  path.app.html.partials,
  path.app.css,
  path.app.js,
  path.app.html.main + '*.html'
];

gulp.task('slim-main', function() {
  gulp.src(path.src.slim.main)
    .pipe(slim({
      pretty: true
    }))
    .pipe(gulp.dest(path.app.html.main));
});

gulp.task('slim-partials', function() {
  gulp.src(path.src.slim.partials)
    .pipe(slim({
      pretty: true
    }))
    .pipe(gulp.dest(path.app.html.partials));
});

gulp.task('sass', function() {
  gulp.src(path.src.sass)
    .pipe(sass())
    .pipe(gulp.dest(path.app.css));
});

gulp.task('coffee', function() {
  gulp.src(path.src.coffee)
    .pipe(coffee({
      bare: true
    }).on('error', gutil.log))
    .pipe(gulp.dest(path.app.js))
});

gulp.task('bower', function() {
  return bower(path.bower);
});

gulp.task('clean', function(cb) {
  return gulp.src(cleanArr, {
      read: false
    })
    .pipe(rimraf({
      force: true
    }));
});

@@ -427,16 +427,329 @@
 ss'%5D);%0A%0A
+var srcPath = './src/';%0Avar appPath = './www/';%0A%0Avar pathBuilder = function(base, path) %7B%0A  return base + path;%0A%7D;%0A%0Afunction partialOneArg(f, a) %7B%0A  return function(b) %7B%0A    return f(a, b);%0A  %7D%0A%7D;%0A%0Avar pathBaseOnSrc = partialOneArg(pathBuilder, srcPath);%0Avar pathBaseOnApp = partialOneArg(pathBuilder, appPath);%0A%0A
 var path
@@ -786,23 +786,31 @@
   main: 
-'./src/
+pathBaseOnSrc('
 slim/*.s
@@ -813,16 +813,17 @@
 /*.slim'
+)
 ,%0A      
@@ -832,23 +832,31 @@
 rtials: 
-'./src/
+pathBaseOnSrc('
 slim/par
@@ -868,16 +868,17 @@
 /*.slim'
+)
 %0A    %7D,%0A
@@ -887,23 +887,31 @@
   sass: 
-'./src/
+pathBaseOnSrc('
 scss/*.s
@@ -914,16 +914,17 @@
 /*.scss'
+)
 ,%0A    co
@@ -929,23 +929,31 @@
 coffee: 
-'./src/
+pathBaseOnSrc('
 coffee/*
@@ -960,16 +960,17 @@
 .coffee'
+)
 %0A  %7D,%0A  
@@ -1000,24 +1000,33 @@
   main: 
-'./www/'
+pathBaseOnApp('')
 ,%0A      
@@ -1035,23 +1035,31 @@
 rtials: 
-'./www/
+pathBaseOnApp('
 partials
@@ -1060,16 +1060,17 @@
 rtials/'
+)
 %0A    %7D,%0A
@@ -1082,20 +1082,29 @@
 ss: 
-'./www/
+pathBaseOnApp('
 css/'
+)
 ,%0A  
@@ -1113,19 +1113,28 @@
 js: 
-'./www/
+pathBaseOnApp('
 js/'
+)
 %0A  %7D
@@ -1144,23 +1144,31 @@
  bower: 
-'./src/
+pathBaseOnSrc('
 bower_co
@@ -1176,16 +1176,17 @@
 ponents'
+)
 %0A%7D;%0A%0Avar

Update gulpfile