 
 
 
+# The following variable is replaced by Grunt with the version found
+# in package.json
+VERSION = '@@version'
+
+
+
 # ## Compile
 #
 # The function called when `kdc-plus compile` is used.

      log "Error Saving Compiled KDApp: #{err.message}"
      process.exit 1

    # Now that we've declared everything, pipe our loader to our "outer",
    # which is the final destination for our stream.

    # First, write our closure start to the outer
    outer.write "/* Compiled by kdc-plus v#{opts.version} */\n(function(){\n"

    # On data, write it to our outer
    loader.on 'data', (chunk) -> outer.write chunk

    # And finally, when the data ends, close our app closure
    loader.on 'end', -> outer.write "\n})()"




        transExt = opts.transExt[i]
        loader.transform StdioTransform.Filter transform, transExt

    # Now we finally pipe the output out of our program. We either pipe it to
    # a file, or STDOUT (if defined)
    if opts.pipe
      outer   = process.stdout

      # For pipe, there is nothing we need to end. So when our loader is done,
      # make sure to add our closure-close, and log success
      loader.on 'end', ->
        outer.write "\n})();"
        log "KDApp Compiled Successfully!"
    else
      outer   = fs.createWriteStream path.join appPath, opts.file

      # When our loader is done, close our closure and end the file stream
      loader.on 'end', -> outer.end "\n})();"
      # We wait till the file stream ends fully to ensure we don't prematurely
      # call success if an error occurs.. it just looks bad when you do that.
      outer.on 'finish', ->
        log "KDApp Compiled Successfully!"

    loader.on 'error', (err) ->
      log "Error Compiling KDApp: #{err.message}"
