             catch err
               console.log err.stack
 
-        # Run the end hook and callback only after everything is compiled.
-        if ++compiled is count
-          info.hookFns.end?()
-          fn?()
+  # Run the end hook and callback only after everything is compiled.
+  info.hookFns.end?()
+  fn?()
 
 # Use Stitch to create a browser bundle.
 bundle = (info, fn) ->


# Compile all CoffeeScript sources for Node.
buildNode = (info, watch, fn) ->
  # Calculate path count.
  count = 0
  count++ for _ of info.paths

  # Run a hook before the build process starts.
  info.hookFns.begin?()

  # Iterate through, while counting compiled paths.
  compiled = 0
  for sourcePath, targetPath of info.paths
    do (sourcePath, targetPath) ->
      h.withFiles path.join(sourcePath, '**/*.coffee'), (files) ->

    h.watchFiles glob.globSync("{#{paths.join()}}"), ->
      bundle info

# Compile source for Node and browsers.
build = (fn) ->
  info = loadinfo()
  buildNode info, false, ->
