Skip to content

Config setting for turning on asset caching #118

Closed
wants to merge 1 commit into from
View
6 source/lib/archetypes/app/default/application.json
@@ -2,5 +2,11 @@
{
"settings": [ "master" ],
"specs": {}
+ },
+ {
+ "settings": [ "environment:development" ],
+ "staticHandling": {
+ "forceUpdate": true
+ }
}
]
View
6 source/lib/archetypes/app/full/application.json
@@ -42,5 +42,11 @@
}
}
+ },
+ {
+ "settings": [ "environment:development" ],
+ "staticHandling": {
+ "forceUpdate": true
+ }
}
]
View
6 source/lib/archetypes/app/simple/application.json
@@ -2,5 +2,11 @@
{
"settings": [ "master" ],
"specs": {}
+ },
+ {
+ "settings": [ "environment:development" ],
+ "staticHandling": {
+ "forceUpdate": true
+ }
}
]
View
13 source/lib/middleware/mojito-handler-static.js
@@ -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);
Something went wrong with that request. Please try again.