setting cache headers to 0 on development mode

v1.18.x
Julian Lam 11 years ago
parent 38da65ee58
commit 0188ea9a3b

@ -245,7 +245,6 @@ define(function() {
readMembers = modalEl.find('#category-permissions-read'),
writeMembers = modalEl.find('#category-permissions-write');
socket.emit('api:admin.categories.getPrivilegeSettings', cid, function(err, privilegeList) {
console.log('privlist', privilegeList);
var readLength = privilegeList['+r'].length,
writeLength = privilegeList['+w'].length,
readFrag = document.createDocumentFragment(),

@ -124,7 +124,10 @@ var fs = require('fs'),
function(next) {
// CSS Files for plugins
if (pluginData.css && pluginData.css instanceof Array) {
if (global.env === 'development') winston.info('[plugins] Found ' + pluginData.css.length + ' CSS file(s) for plugin ' + pluginData.id);
if (global.env === 'development') {
winston.info('[plugins] Found ' + pluginData.css.length + ' CSS file(s) for plugin ' + pluginData.id);
}
_self.cssFiles = _self.cssFiles.concat(pluginData.css.map(function(file) {
return path.join('/plugins', pluginData.id, file);
}));

@ -31,7 +31,9 @@ var nconf = require('nconf'),
var fullPath = path.join(Plugins.staticDirs[req.params.id], relPath);
fs.exists(fullPath, function(exists) {
if (exists) {
res.sendfile(fullPath);
res.sendfile(fullPath, {
maxAge: app.enabled('cache') ? 5184000000 : 0
});
} else {
res.redirect('/404');
}

@ -118,6 +118,11 @@ var path = require('path'),
});
};
// Cache static files on production
if (global.env !== 'development') {
app.enable('cache');
}
// Middlewares
app.configure(function() {
async.series([
@ -181,7 +186,7 @@ var path = require('path'),
// Theme's static directory
if (themeData[2]) {
app.use('/css/assets', express.static(path.join(__dirname, '../node_modules', themeData[1], themeData[2]), {
maxAge: 5184000000
maxAge: app.enabled('cache') ? 5184000000 : 0
}));
if (process.env.NODE_ENV === 'development') {
winston.info('Static directory routed for theme: ' + themeData[1]);
@ -190,7 +195,7 @@ var path = require('path'),
if (themeData[3]) {
app.use('/templates', express.static(path.join(__dirname, '../node_modules', themeData[1], themeData[3]), {
maxAge: 5184000000
maxAge: app.enabled('cache') ? 5184000000 : 0
}));
if (process.env.NODE_ENV === 'development') {
winston.info('Custom templates directory routed for theme: ' + themeData[1]);
@ -252,7 +257,7 @@ var path = require('path'),
// Static directory /public
app.use(nconf.get('relative_path'), express.static(path.join(__dirname, '../', 'public'), {
maxAge: 5184000000
maxAge: app.enabled('cache') ? 5184000000 : 0
}));
// 404 catch-all

Loading…
Cancel
Save