From ed89a13fe655ba6ad12674a141be5657910fb01e Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 29 Mar 2017 12:55:36 +0200 Subject: [PATCH] progress on adding version string to some css --- www/common/boot2.js | 2 ++ www/common/rewrite-css.js | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 www/common/rewrite-css.js diff --git a/www/common/boot2.js b/www/common/boot2.js index 72519b73e..2ea7f9b73 100644 --- a/www/common/boot2.js +++ b/www/common/boot2.js @@ -3,4 +3,6 @@ define([], function () { // fix up locations so that relative urls work. require.config({ baseUrl: window.location.pathname }); require([document.querySelector('script[data-bootload]').getAttribute('data-bootload')]); + require(['/common/rewrite-css.js']); }); + diff --git a/www/common/rewrite-css.js b/www/common/rewrite-css.js new file mode 100644 index 000000000..98c81b35c --- /dev/null +++ b/www/common/rewrite-css.js @@ -0,0 +1,10 @@ +define([ + '/api/config', +], function (Config) { + if (!(Config && Config.requireConf && Config.requireConf.urlArgs)) { return; } + + document.querySelectorAll('link[rel="stylesheet"][data-rewrite-href]').forEach(function (e) { + e.setAttribute('href', e.getAttribute('data-rewrite-href')); + }); +}); +