Last active
August 29, 2015 13:58
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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