       log "Error Compiling KDApp: #{err.message}"
       process.exit 1
 
-    destination = fs.createWriteStream path.join appPath, 'index.js'
-    destination.on 'error', (err) ->
+
+    # Now we finally pipe the output out of our program. We either pipe it to
+    # a file, or STDOUT (if defined)
+    if opts.pipe
+      out     = process.stdout
+    else
+      out     = fs.createWriteStream path.join appPath, opts.file
+
+    out.on 'error', (err) ->
       log "Error Saving Compiled KDApp: #{err.message}"
       process.exit 1
 
-    destination.on 'finish', ->
+    out.on 'finish', ->
       log "KDApp Compiled Successfully!"
 
-    loader.pipe destination
+    loader.pipe out
 
 
 

    if err?
      log "Error Loading Manifest: #{err.message}"
      return process.exit 1

    if vwarns? then log warning for warning in vwarns
    if vfails?

  # Define our opts
  opts.version '@@version'
  opts.usage '[options] <kdapp directory>'
  opts.option '-p, --pipe', 'Pipe to STDOUT instead of to a file'
  opts.option '-f, --file <file>', 'Choose the output file'
  opts.option '--no-coffee', 'No coffee-script support'
  opts.option '-c, --commonjs', 'Support commonjs'
  opts.parse argv

  [appPath, unhandledArgs] = opts.args

