Skip to content

Instantly share code, notes, and snippets.

@peterfox
Last active August 29, 2015 13:58
Show Gist options
  • Save peterfox/10115377 to your computer and use it in GitHub Desktop.
Save peterfox/10115377 to your computer and use it in GitHub Desktop.
Syncs all files beneth a projects /public/assets folder to an S3 bucket that can then be used to back a CloudFront instance
var gulp = require('gulp'),
awspublish = require('gulp-awspublish'),
rename = require('gulp-rename');
var publisher = awspublish.create({ key: '...', secret: '...', bucket: '...' });
gulp.task('publish', function() {
gulp.src('public/assets/**')
.pipe(rename(function (path) {
path.dirname = 'assets/' + path.dirname;
}))
.pipe(publisher.publish())
.pipe(publisher.sync())
.pipe(awspublish.reporter());
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment