laggingreflex
laggingreflex

Reputation: 34627

How can I force clients to refresh JavaScript/CSS files rendered with Jade in Node.js?

Acc. to this the best way to introduce ?<version> number upon every reload. How do I do that when rendering files with Jade in Node.js?

Also what about css files?

Upvotes: 1

Views: 561

Answers (1)

laggingreflex
laggingreflex

Reputation: 34627

Figured out, I could add time

app.configure(function() {
    //...
    app.use(setlocalTime);
    //...
    app.use(app.router);
});
function setlocalTime(req, res, next) {
    app.locals.time = Date.now();
    next();
}

script(src='/scripts/script.js?'+time)

Upvotes: 1

Related Questions