Static content caching
This commit is contained in:
4
app.js
4
app.js
@@ -41,7 +41,7 @@ var app = express();
|
||||
/**
|
||||
* Express configuration.
|
||||
*/
|
||||
|
||||
app.locals.cacheBuster = Date.now();
|
||||
app.set('port', process.env.PORT || 3000);
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'jade');
|
||||
@@ -63,7 +63,7 @@ app.use(function(req, res, next) {
|
||||
app.use(flash());
|
||||
app.use(less({ src: __dirname + '/public', compress: true }));
|
||||
app.use(app.router);
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
app.use(express.static( path.join(__dirname, 'public'), { maxAge: 864000000 } ));
|
||||
app.use(function(req, res) {
|
||||
res.status(404);
|
||||
res.render('404');
|
||||
|
@@ -9,14 +9,14 @@ html
|
||||
|
||||
title #{title} - Starter Template for Bootstrap
|
||||
|
||||
link(href='/css/lib/font-awesome.min.css', rel='stylesheet')
|
||||
link(href='/css/lib/animate.css', rel='stylesheet')
|
||||
link(href='/css/lib/font-awesome.min.css?v=#{cacheBuster}', rel='stylesheet')
|
||||
link(href='/css/lib/animate.css?v=#{cacheBuster}', rel='stylesheet')
|
||||
|
||||
link(href='/css/styles.css', rel='stylesheet')
|
||||
link(href='/css/styles.css?v=#{cacheBuster}', rel='stylesheet')
|
||||
|
||||
script(src='/js/lib/jquery.js')
|
||||
script(src='/js/lib/bootstrap.js')
|
||||
script(src='/js/main.js')
|
||||
script(src='/js/lib/jquery.js?v=#{cacheBuster}')
|
||||
script(src='/js/lib/bootstrap.js?v=#{cacheBuster}')
|
||||
script(src='/js/main.js?v=#{cacheBuster}')
|
||||
body
|
||||
#wrap
|
||||
.navbar.navbar-default.navbar-fixed-top
|
||||
|
Reference in New Issue
Block a user