 
   return readable
 
+# get compile result via cache or compiling
+getResult = (step, bundle) ->
+  cacheFileName = step.fullInputPath + '.cached'
+  compileChanges = checkFileChanges step
+
+  if compileChanges
+    # call our wrapped function with the readable stream as its argument
+    string = getString bundle #wrappedFn bundle
+
+    # write result to a cache file
+    fs.writeFileSync cacheFileName, string
+
+  else
+    string = fs.readFileSync cacheFileName, encoding:'utf8'
+
+  return string
+
 # async function for reading entire bundle output into a string
 # wrap to convert to a synchronous function
 getString = Meteor.wrapAsync (bundle, cb) ->


  return debug

getReadable = (step) ->

  # Browserify accepts a Readable stream as input, so, we'll use a PassThrough

  bundle = bundle.pipe exorcist mapFileName, step.pathForSourceMap

  try # try-catch for browserify errors

    # get browserify result from either the cache or processing
    string = getResult step, bundle

    # read the generated source map from the file
    sourceMap = fs.readFileSync mapFileName, encoding:'utf8'
