-
-
Save bkw/3dd96f05656a7e102e74 to your computer and use it in GitHub Desktop.
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') | |
, jade = require('gulp-jade') | |
, rename = require('gulp-rename') | |
, minifyHTML = require('gulp-minify-html') | |
, minifyInline = require('gulp-minify-inline') | |
, zopfli = require('gulp-zopfli') | |
, AWS = require('aws-sdk') | |
, through2 = require('through2') | |
, aws = new AWS.S3({accessKeyId: 'key', secretAccessKey: 'secret', region: 'eu-central-1'}) | |
, s3 = require('vinyl-s3')(aws, { | |
Bucket: 'mybucket', | |
CacheControl: 'max-age:86400, no-transform, public', | |
ContentType: 'text/html', | |
ContentEncoding: 'gzip' | |
}) | |
; | |
gulp.task('html', function () { | |
gulp.src('./views/index.jade') | |
.pipe(jade({locals: {foo: 'bar'})) | |
.pipe(minifyInline()) | |
.pipe(minifyHTML()) | |
.pipe(zopfli()) | |
.pipe(rename({basename: 'index', extname: '.html'})) | |
.pipe(through2.obj(function(file, _, callback) { | |
file.contentType = 'text/html'; | |
this.push(file); | |
callback(); | |
})) | |
.pipe(s3.dest('somedir')) | |
}); | |
gulp.task('default', ['html']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
expected result: upload to s3 bucket
mybucket
assomedir/index.html
.Actual result:
somedir/ndex.html
.