Loader: Inject assets CSS

This commit is contained in:
Bui
2019-02-06 18:27:31 +00:00
parent a921b38e3e
commit b3ed655e44
3 changed files with 11 additions and 3 deletions

View File

@@ -37,6 +37,10 @@ var assets = {
"debug.css",
"songbg.css"
],
"assetsCss": [
"fonts/fonts.css",
"img/img.css"
],
"img": [
"title-screen.png",
"notes.png",

View File

@@ -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()