             callback null, options
       else
         callback null, options
+
+    # provide modules specefied with the require option to the template context
+    (options, callback) ->
+      if typeof options.require is 'string'
+        options.require = options.require.split ','
+      # resolve module paths
+      async.map options.require, resolveModule, (error, result) ->
+        options.require = result
+        callback error, options
+    (options, callback) ->
+      # load modules and add them to options.locals
+      async.forEach options.require, (moduleName, callback) ->
+        logger.verbose "loading module #{ moduleName }"
+        try
+          options.locals[moduleName] = require moduleName
+          callback()
+        catch error
+          callback error
+      , (error) ->
+        callback error, options
+
     (options, callback) ->
       if typeof options.plugins is 'string'
         options.plugins = options.plugins.split ','
       # resolve plugin paths if required as file
-      async.map options.plugins, (item, callback) ->
-        if item[...2] is './'
-          item = path.resolve workDir, item
-        callback null, item
-      , (error, result) ->
+      async.map options.plugins, resolveModule, (error, result) ->
         options.plugins = result
         callback error, options
     (options, callback) ->

  "  -i, --contents [path]         contents location (defaults to #{ defaults.contents.default })"
  "  -t, --templates [path]        template location (defaults to #{ defaults.templates.default })"
  "  -L, --locals [path]           optional path to json file containing template context data"
  "  -P, --plugins                 comma separated list of modules to load as plugins"
].join '\n'



  workDir = path.resolve (argv.chdir or process.cwd())
  logger.verbose "resolving options - work directory: #{ workDir }"

  resolveModule = (moduleName, callback) ->
    if moduleName[...2] is './'
      callback null, path.resolve workDir, moduleName
    else
      callback null, moduleName

  async.waterfall [
    (callback) ->
