kretschmann.cat/gulpfile.js

40 lines
954 B
JavaScript

'use strict';
var gulp = require('gulp'),
awspublish = require('gulp-awspublish')
// paths
var DIST = './site/';
// deployment
var S3BUCKET = 'kretschmann.cat',
S3REGION = 'eu-central-1';
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// Deployment
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gulp.task('deploy', function() {
// create publisher, define config
var publisher = awspublish.create({
params: {
Bucket: S3BUCKET
},
region: S3REGION
});
// define custom headers
var headers = {
'Cache-Control': 'public,max-age=0,must-revalidate'
};
return gulp.src(DIST + '**/*')
.pipe(publisher.publish(headers))
.pipe(publisher.sync()) // delete files in bucket that are not in local folder
.pipe(awspublish.reporter({
states: ['create', 'update', 'delete']
}));
});