From b3ed655e44e0efed759e0975325b100d3c541986 Mon Sep 17 00:00:00 2001 From: Bui Date: Wed, 6 Feb 2019 18:27:31 +0000 Subject: [PATCH] Loader: Inject assets CSS --- public/src/js/assets.js | 4 ++++ public/src/js/loader.js | 6 ++++++ templates/index.html | 4 +--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/public/src/js/assets.js b/public/src/js/assets.js index a5e74f0..5a0b0e4 100644 --- a/public/src/js/assets.js +++ b/public/src/js/assets.js @@ -37,6 +37,10 @@ var assets = { "debug.css", "songbg.css" ], + "assetsCss": [ + "fonts/fonts.css", + "img/img.css" + ], "img": [ "title-screen.png", "notes.png", diff --git a/public/src/js/loader.js b/public/src/js/loader.js index c5badbd..6e7a81c 100644 --- a/public/src/js/loader.js +++ b/public/src/js/loader.js @@ -40,6 +40,12 @@ class Loader{ stylesheet.href = "/src/css/" + name + queryString document.head.appendChild(stylesheet) }) + assets.assetsCss.forEach(name => { + var stylesheet = document.createElement("link") + stylesheet.rel = "stylesheet" + stylesheet.href = gameConfig.assets_baseurl + name + queryString + document.head.appendChild(stylesheet) + }) var checkStyles = () => { if(document.styleSheets.length >= cssCount){ resolve() diff --git a/templates/index.html b/templates/index.html index 4a78a61..d88252b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -8,9 +8,7 @@ - - - +