     object[key] = properties[key]
   object
 
+recursiveExtend = (object, properties) ->
+  Object.keys(properties).forEach (key) ->
+    value = properties[key]
+    if typeof value is 'object' and value?
+      recursiveExtend object[key], properties[key]
+    else
+      object[key] = properties[key]
+  object
+
 exports.deepFreeze = deepFreeze = (object) ->
   Object.keys(Object.freeze(object))
     .map (key) ->
       object[key]
     .filter (value) ->
-      typeof value is object and not Object.isFrozen(value)
+      typeof value is 'object' and value? and not Object.isFrozen(value)
     .forEach(deepFreeze)
   object
 

  config.rootPath = config.paths.root
  config.buildPath = config.paths.build

  replaceSlashes config if process.platform is 'win32'
  config

exports.loadConfig = (configPath = 'config.coffee') ->
  require.extensions['.coffee'] ?= (module, filename) ->
    content = coffeescript.compile fs.readFileSync filename, 'utf8', {filename}
    module._compile content, filename

  fullPath = sysPath.resolve configPath
  try
    {config} = require fullPath
  catch error
    logger.error "couldn\'t load config #{configPath}. #{error}"
    throw new Error()
  setConfigDefaults config, fullPath
  recursiveExtend config, options
  deepFreeze config
  config

exports.loadPlugins = (config, callback) ->
