Hi!
In OJS (I’m now running 3.2.1.1), assume that I’ve created and uploaded a custom stylesheet (custom.css
) for my journal (as described here). So far so good, my custom stylesheet is in the DB:
DB [ojs]> SELECT setting_name, setting_value FROM journal_settings WHERE journal_id = 1 AND setting_name = 'styleSheet';
+--------------+----------------------------------------------------------------------------------------------------------------------------+
| setting_name | setting_value |
+--------------+----------------------------------------------------------------------------------------------------------------------------+
| styleSheet | a:3:{s:4:"name";s:10:"custom.css";s:10:"uploadName";s:14:"styleSheet.css";s:12:"dateUploaded";s:19:"2020-02-20 01:23:45";} |
+--------------+----------------------------------------------------------------------------------------------------------------------------+
and it’s loaded in the HTML source:
<link rel="stylesheet" href="http://localhost/public/journals/1/styleSheet.css?v=3.2.1.1" type="text/css" />
It works as expected.
But, what if I want to make updates to my custom stylesheet? The admin UI only allows uploading a single custom stylesheet, and it only allows removing that single custom stylesheet, not updating it. But even if I remove it and upload a new custom stylesheet right away, the href
of the stylesheet in the HTML source remains the same and therefore the browser cache will still remember and use the old custom stylesheet. There are 2 reasons for that:
- The name of my custom stylesheet is always
styleSheet.css
, regardless of the name of the custom stylesheet file I upload (although that information is saved in the DB - see above) - The
href
of the stylesheet in the HTML source is suffixed by the vesion of the OJS I’m running (?v=3.2.1.1
in this case) and not some sort of version of the custom stylesheet I’ve uploaded (although the upload timestamp is saved in the DB - see above).
The obvious question is: is there a way to update my custom stylesheet and have the browser force the cache refresh? If not, this seems like an oversight, worthy of a github issue (BTW, I couldn’t find an existing one, but please let me know if one exists).
In the meantime, are there any other recommendations?
Many thanks!