var gulp = require('gulp');

module.exports = function(s3opts,awsS3,distPath) {
  var stream = gulp.src("**",{cwd:distPath}).on("data",function(file) {
    if (file.stat.isFile()) {
      var newFilename = file.relative;

      awsS3.putObject({
        Bucket: s3opts.aws.bucket,
        ACL: "bucket-owner-full-control",
        //ACL: "private",
        Key: newFilename,
        Body: file.contents
      },function(err,response) {
        if (err) {
          // TODO throw error
          console.warn(err,response);
        }
      });
    }
  });
  return stream;
};

@@ -215,16 +215,217 @@
 ative;%0A%0A
+      if (s3opts.prefix) %7B%0A%0A        newFilename = s3opts.prefix + '/' + newFilename;%0A%0A        // Ensure the path does not start with a '/'%0A        newFilename = newFilename.replace(/%5E%5C//,'');%0A      %7D%0A%0A
       aw

fix for prefix when writing to s3