Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Config setting for turning on asset caching #118

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions source/lib/archetypes/app/default/application.json
Expand Up @@ -2,5 +2,11 @@
{
"settings": [ "master" ],
"specs": {}
},
{
"settings": [ "environment:development" ],
"staticHandling": {
"forceUpdate": true
}
}
]
6 changes: 6 additions & 0 deletions source/lib/archetypes/app/full/application.json
Expand Up @@ -42,5 +42,11 @@
}

}
},
{
"settings": [ "environment:development" ],
"staticHandling": {
"forceUpdate": true
}
}
]
6 changes: 6 additions & 0 deletions source/lib/archetypes/app/simple/application.json
Expand Up @@ -2,5 +2,11 @@
{
"settings": [ "master" ],
"specs": {}
},
{
"settings": [ "environment:development" ],
"staticHandling": {
"forceUpdate": true
}
}
]
13 changes: 4 additions & 9 deletions source/lib/middleware/mojito-handler-static.js
Expand Up @@ -237,19 +237,14 @@ function staticProvider(store, globalLogger) {
'Content-Type': mimetype + (charset ? '; charset="' +
charset + '"' : ''),
'Content-Length': stat.size,
//"Last-Modified": stat.ctime.toUTCString(),
// TODO: [Issue 91] See todo below
'Last-Modified': new Date().toUTCString(),
'Last-Modified': (options.forceUpdate) ? new Date().toUTCString() : stat.ctime.toUTCString(),
'Cache-Control': 'public max-age=' + (maxAge / 1000),
'ETag': etag(stat)
};

// TODO: [Issue 91] Removed for dev, need to add a switch
// here
// Conditional GET
//if (!modified(req, headers)) {
// return notModified(res, headers);
//}
if (!options.forceUpdate && !modified(req, headers)) {
return notModified(res, headers);
}

// logger.log('(staticProvider) serving static file: ' +
// filename);
Expand Down