Reorder CSS loading

This commit is contained in:
Dmitry Lyzo 2020-08-13 00:15:02 +03:00
parent 808a670b55
commit c32f83a19e
2 changed files with 27 additions and 13 deletions

View file

@ -384,11 +384,15 @@ function initClient() {
return response.text();
})
.then(function(css) {
// Inject the branding css as a dom element in body so it will take
// precedence over other stylesheets
var style = document.createElement('style');
style.appendChild(document.createTextNode(css));
document.body.appendChild(style);
let style = document.querySelector('#cssBranding');
if (!style) {
// Inject the branding css as a dom element in body so it will take
// precedence over other stylesheets
style = document.createElement('style');
style.id = 'cssBranding';
document.body.appendChild(style);
}
style.textContent = css;
})
.catch(function(err) {
console.warn('Error applying custom css', err);