Jump to content

wrap css/js calls with autov()


Recommended Posts

Hey plugin authors,


Please consider wrapping the css/js calls in your plugins with autov(), so they look like this:

  <link type="text/css" rel="stylesheet" href="<?autov('/webGui/styles/jquery.filetree.css')?>">
  <script type="text/javascript" src="<?autov('/webGui/javascript/dynamix.js')?>"></script>

autov() appends the timestamp of the file to the call, so it renders like this:

  <link type="text/css" rel="stylesheet" href="/webGui/styles/jquery.filetree.css?v=1535741906">
  <script type="text/javascript" src="/webGui/javascript/dynamix.js?v=1535741906"></script>

The main benefit is that after an upgrade the css/js links will automatically change, which ensures the browser won't load stale copies of those files.


autov() has been in Unraid since the current repository was added to GitHub on Oct 24, 2015:
so unless your plugin targets a *very* old version of Unraid it won't have issues with this.


And starting with 6.6.0-rc2, nginx tells the browser to permanently cache all css/js files that have version strings appended this way. This should give a minor speed boost to every page load, since the browser won't have to check and see if the file has been updated:


If it helps, here are some examples of the change in the main webgui:


Link to comment


This topic is now archived and is closed to further replies.

  • Create New...