diff --git a/templates/emscripten/template/index.html b/templates/emscripten/template/index.html index 3465820a1..747566187 100644 --- a/templates/emscripten/template/index.html +++ b/templates/emscripten/template/index.html @@ -9,6 +9,9 @@ + ::if favicons::::foreach (favicons):: + ::end::::end:: + ::if linkedLibraries::::foreach (linkedLibraries):: ::end::::end:: @@ -46,7 +49,6 @@ ::if DEBUG::::end:: - diff --git a/tools/platforms/EmscriptenPlatform.hx b/tools/platforms/EmscriptenPlatform.hx index f585ee55b..24d37efc5 100644 --- a/tools/platforms/EmscriptenPlatform.hx +++ b/tools/platforms/EmscriptenPlatform.hx @@ -13,6 +13,8 @@ import lime.tools.CPPHelper; import lime.tools.DeploymentHelper; import lime.tools.HTML5Helper; import lime.tools.HXProject; +import lime.tools.Icon; +import lime.tools.IconHelper; import lime.tools.Orientation; import lime.tools.PlatformTarget; import lime.tools.ProjectHelper; @@ -384,6 +386,26 @@ class EmscriptenPlatform extends PlatformTarget context.CPP_DIR = targetDirectory + "/obj"; context.USE_COMPRESSION = project.targetFlags.exists("compress"); + context.favicons = []; + + var icons = project.icons; + + if (icons.length == 0) + { + icons = [new Icon(System.findTemplate(project.templatePaths, "default/icon.svg"))]; + } + + // if (IconHelper.createWindowsIcon (icons, Path.combine (destination, "favicon.ico"))) { + // + // context.favicons.push ({ rel: "icon", type: "image/x-icon", href: "./favicon.ico" }); + // + // } + + if (IconHelper.createIcon(icons, 192, 192, Path.combine(destination, "favicon.png"))) + { + context.favicons.push({rel: "shortcut icon", type: "image/png", href: "./favicon.png"}); + } + for (asset in project.assets) { var path = Path.combine(targetDirectory + "/obj/assets", asset.targetPath);