 
 
 #*------------------------------------*\
-#     $SASS
+#     $COMPILE SASS
 #*------------------------------------*/
 gulp.task "sass", () ->
   gulp.src(["#{conf.path.dev.scss}/**/*.{scss,sass}"])
     .pipe plumber(conf.plumber)
     .pipe(sourcemaps.init())
-      .pipe sass({errLogToConsole: true})
+    .pipe sass({errLogToConsole: true})
     .pipe(sourcemaps.write('./'))
     .pipe gulp.dest(conf.path.dev.css)
-    .pipe bs.reload(match: '**/*.css')
-
-
-
-
-
-#*------------------------------------*\
-#     $PIXEL &
-#     $VECTOR OPTIM
-#*------------------------------------*/
-gulp.task 'imagemin', () ->
-  files = ['jpg', 'jpeg', 'png', 'svg'].map (ext) ->
-    "#{conf.path.dev.img}/**/*.#{ext}"
-
-  return gulp.src(files)
-    .pipe cache(imagemin {
+    .pipe reload({stream: true})
+
+
+
+
+
+#*------------------------------------*\
+#     $COMPILE COFFEE
+#*------------------------------------*/
+gulp.task "coffee", () ->
+  gulp.src ["#{conf.path.dev.coffee}/**/*.coffee"]
+    .pipe plumber(conf.plumber)
+    .pipe cache(coffee({bare: true}).on('error', gutil.log))
+    .pipe remember()
+    .pipe gulp.dest(conf.path.dev.js)
+    .pipe bs.reload({stream: true})
+
+
+
+
+
+#*------------------------------------*\
+#     $CONCAT JS
+#*------------------------------------*/
+gulp.task "concat", ["coffee"], () ->
+  gulp.src [
+    "#{conf.path.dev.coffee}/lib/toggler.js"
+    "#{conf.path.dev.coffee}/main.js"
+  ]
+    .pipe concat('built.js')
+    .pipe gulp.dest(conf.path.dev.js)
+    .pipe bs.reload({stream: true})
+
+
+
+
+
+#*------------------------------------*\
+#     $MINIFY CSS
+#*------------------------------------*/
+gulp.task "minify:css", ["sass"], () ->
+  gulp.src(["#{conf.path.dev.css}/style.css"])
+    .pipe minifyCSS({keepSpecialComments: 0})
+    .pipe rename({suffix: '.min'})
+    .pipe gulp.dest(conf.path.dev.css)
+
+
+
+
+
+#*------------------------------------*\
+#     $MINIFY JS
+#*------------------------------------*/
+gulp.task "minify:js", ["coffee"], () ->
+  files = [
+    "#{conf.path.dev.js}/built.js"
+  ]
+
+  gulp.src files
+    .pipe uglifyJs()
+    .pipe rename({suffix: '.min'})
+    .pipe gulp.dest(conf.path.dev.js)
+
+
+
+
+
+#*------------------------------------*\
+#     $MINIFY VENDORS
+#*------------------------------------*/
+gulp.task "minify:js:vendors", () ->
+  files = [
+    # "**/#{conf.path.dev.assets}/vendor/[path/to/your/vendor].js",
+  ]
+
+  gulp.src files
+    .pipe uglifyJs()
+    .pipe rename({suffix: '.min'})
+    .pipe gulp.dest('./')
+
+
+
+
+
+#*------------------------------------*\
+#     $MINIFY
+#*------------------------------------*/
+gulp.task "minify", ["sass"], () ->
+  gulp.src(["#{conf.path.dev.css}/style.css"])
+    .pipe minifyCSS({keepSpecialComments: 0})
+    .pipe rev()
+    .pipe rename({suffix: '.min'})
+    .pipe gulp.dest(conf.path.prod.css)
+    .pipe rev.manifest(conf.revManifest.path, conf.revManifest.opts)
+    .pipe gulp.dest('./')
+
+
+
+
+
+#*------------------------------------*\
+#     $REV CSS
+#*------------------------------------*/
+gulp.task "rev:css", ["minify:css"], () ->
+  gulp.src(["#{conf.path.dev.css}/style.min.css"])
+    .pipe rev()
+    .pipe gulp.dest(conf.path.prod.css)
+    .pipe rev.manifest(conf.revManifest.path, conf.revManifest.opts)
+    .pipe gulp.dest('./')
+
+
+
+
+
+#*------------------------------------*\
+#     $REV JS
+#*------------------------------------*/
+gulp.task 'rev:js', ["minify:js"], () ->
+  gulp.src(["#{conf.path.dev.js}/built.min.js"])
+    .pipe rev()
+    .pipe gulp.dest(conf.path.prod.js)
+    .pipe rev.manifest(conf.revManifest.path, conf.revManifest.opts)
+
+
+
+
+
+#*------------------------------------*\
+#     $REV FONTS
+#*------------------------------------*/
+gulp.task "rev:fonts", () ->
+  files = ['eot', 'woff', 'ttf', 'svg'].map (curr) ->
+    "#{conf.path.dev.fnt}/**/*#{curr}"
+
+  gulp.src(files)
+    .pipe rev()
+    .pipe gulp.dest(conf.path.prod.fnt)
+    .pipe rev.manifest(conf.revManifest.path, conf.revManifest.opts)
+    .pipe gulp.dest('./')
+
+
+
+
+
+#*------------------------------------*\
+#     $REV IMAGES & OPTIMISE
+#*------------------------------------*/
+gulp.task 'rev:images', () ->
+  return gulp.src("#{conf.path.dev.img}/**/*.{jpg,jpeg,png,svg}")
+    .pipe imagemin {
       optimizationLevel: 3,
       progressive: true,
       interlaced: true,



#*------------------------------------*\
#     $UPDATE NPM DEPS
#*------------------------------------*/
gulp.task 'update_deps', shell.task 'npm-check-updates -u'




#*------------------------------------*/
gulp.task "watch", ["sass", "coffee", "browser-sync"], () ->
  gulp.watch "#{conf.path.dev.scss}/**/*.scss", ["sass"]
  gulp.watch "#{conf.path.dev.coffee}/**/*.coffee", ["concat", "bs-reload"]
  gulp.watch "#{conf.path.dev.views}/**/*.html.php", ["bs-reload"]


