Skip to content
This repository has been archived by the owner on Mar 22, 2024. It is now read-only.

Commit

Permalink
Merge pull request #46 from Financial-Times/hashed-assets-rename
Browse files Browse the repository at this point in the history
Rename hashed assets
  • Loading branch information
matthew-andrews committed Apr 7, 2015
2 parents 4489dd1 + c984d33 commit 064d052
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tasks/deploy-hashed-assets-s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ function hashAndUpload(opts) {
var file = opts.file;
var app = opts.app;
var bucket = 'ft-next-hashed-assets-prod';
var key = 'next-hashed-assets/' + app + '/' + file.hashedName;
var key = 'hashed-assets/' + app + '/' + file.hashedName;

return new Promise(function(resolve, reject) {
var s3bucket = new aws.S3({params: {Bucket: bucket}});
var s3bucket = new aws.S3({ params: { Bucket: bucket } });
var params = {
Key: key,
Body: file.content,
ACL: 'public-read',

// @arjun, did you think this was in milliseconds? It's fine to set a cache header of 19.165 years but seems like an odd choice
CacheControl: 'public, max-age=604800000'
};
s3bucket.upload(params, function(err, data) {
Expand Down Expand Up @@ -80,7 +82,7 @@ module.exports = function(app) {
var content;
if (file.name === 'main.js') {
content = file.content.toString('utf8');
content = content.replace('/# sourceMappingURL=/' + app + '/' + file.name + '.map', '/# sourceMappingURL=/next-hashed-assets/' + app + '/' + mapHashName);
content = content.replace('/# sourceMappingURL=/' + app + '/' + file.name + '.map', '/# sourceMappingURL=/hashed-assets/' + app + '/' + mapHashName);
file.content = new Buffer(content, 'utf8');
}
return file;
Expand Down

0 comments on commit 064d052

Please sign in to comment.