   done?()
 
 
+# implementation credit:
+#
+#   https://github.com/gulpjs/gulp/blob/master/docs/recipes/browserify-uglify-sourcemap.md
 gulp.task 'browserify', ->
-  gulp
-    .src(DIST.SERVER.files())
-    .pipe(concat DIST.CLIENT.file)
+  browserify(entries: DIST.main, debug: true)
+    .bundle()
+    .pipe(source(DIST.CLIENT.file))
+    .pipe(buffer())
+    .pipe(sourcemaps.init loadMaps: true)
+    .pipe(uglify())
+    .pipe(sourcemaps.write './')
     .pipe(gulp.dest DIST.CLIENT.base)
 
 
-gulp.task 'build', gulp.series('clean', 'coffee')+gulp.task 'build', gulp.series('clean', 'coffee', 'browserify')

DIST =
  base: "dist"

  SERVER:
    base: 'dist/server'


coffee = require 'gulp-coffee'
concat = require 'gulp-concat'

source = require 'vinyl-source-stream'
buffer = require 'vinyl-buffer'
uglify = require 'gulp-uglify'
sourcemaps = require 'gulp-sourcemaps'
browserify = require 'browserify'

del = require 'del'


