Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
css last modified
I was thinking about submitting this to GitHub.

Any thoughts on the following change? It would allow for effective caching of css.

global.php (around line 356)

$theme_stylesheets[basename($page_stylesheet)] = "<link type=\"text/css\" rel=\"stylesheet\" href=\"{$stylesheet_url}\" />\n";

$lastmod = filemtime($page_stylesheet);
$theme_stylesheets[basename($page_stylesheet)] = "<link type=\"text/css\" rel=\"stylesheet\" href=\"{$stylesheet_url}?lastmod={$lastmod}\" />\n";
A great thought!

Adding a query string ({$stylesheet_url}?lastmod) to the CSS file would cause an immediate refresh of changes in the stylesheet (without forcing the browser to refresh manually). That's the behaviour of most common browsers.

A single build version/counter ({$stylesheet_url}?build) would comply to take effect instead of ?lastmod=value.

[Image: logo_wernicke_8040.png]
MyBB Forum + innovative full-responsive Theme
File hash could also work, but it might be longer.

Forum Jump:

Users browsing this thread: 1 Guest(s)