-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Suggestion] different headers for some files #136
Comments
I made this work by doing 2, with different cache file names, and then setting the index file that i want to add a different header. And in the second task only do file upload gulp.task('copyIndexToS3', function() {
// If the aws file are unavailable do nothing
if (!awsKeys) {
// To setup permissions, and policies check the article linked in the top
console.log('Setup your aws keys, and bucket correctly guidelines are found in the link in gulp/cdn-s3.js file');
return gulp.src('./dist/**');
}
var keysObj = live === true ? awsKeys.prod : awsKeys.dev;
var publisher = awspublish.create(keysObj, {
cacheFileName: '.awspublish-' + env + '.example.com-index'
});
return gulp.src([
'dist/index.html'
])
.pipe(awspublish.gzip())
.pipe(publisher.publish({
'Cache-Control': 'no-cache, no-store, must-revalidate',
'Expires': 0
}, {
createOnly: true
}))
.pipe(publisher.cache())
.pipe(awspublish.reporter());
});
gulp.task('copyToS3', function() {
// If the aws file are unavailable do nothing
if (!awsKeys) {
// To setup permissions, and policies check the article linked in the top
console.log('Setup your aws keys, and bucket correctly guidelines are found in the link in gulp/cdn-s3.js file');
return gulp.src('./dist/**');
}
var keysObj = live === true ? awsKeys.prod : awsKeys.dev;
var publisher = awspublish.create(keysObj, {
cacheFileName: '.awspublish-' + env + '.example.com'
});
return gulp.src([
'dist/**',
'!dist/index.html',
'!dist/**/*.test*',
'!dist/rev-manifest.json',
])
.pipe(awspublish.gzip())
.pipe(publisher.publish({
'Cache-Control': 'max-age=315360000, no-transform, public'
}))
.pipe(publisher.cache())
.pipe(publisher.sync())
.pipe(awspublish.reporter());
}); |
@sp90 could you post an example... Currently I would want to set |
@martinmicunda see post above But i do think that it should have a feature to customize cache for each file maybe a function run for each file that can be injected in publish ex .pipe(publisher.publish(function(filepath) {
if (filepath === './dist/index.html') {
return {
'Cache-Control': 'max-age=315360000, no-transform, public'
}
}
})) |
@sp90 thanks! Yeah I agree it should be implemented in the plugin. I am facing an issue when I set header |
Related to #23? |
Hi thanks for a great plugin,
I want to know how to set different headers for different files, is this possible ?
This could work nicely if it could be extended like this:
The text was updated successfully, but these errors were encountered: