From f580ea149c9b9ac0c223ae61efc42abb21be8e26 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Thu, 29 Sep 2016 14:29:01 -0700 Subject: [PATCH] Add favicon for HTML5 --- lime/tools/platforms/HTML5Platform.hx | 24 ++++++++++++++++++++++++ templates/html5/template/index.html | 3 +++ 2 files changed, 27 insertions(+) diff --git a/lime/tools/platforms/HTML5Platform.hx b/lime/tools/platforms/HTML5Platform.hx index e43c40661..22647d68f 100644 --- a/lime/tools/platforms/HTML5Platform.hx +++ b/lime/tools/platforms/HTML5Platform.hx @@ -7,11 +7,13 @@ import lime.tools.helpers.AssetHelper; import lime.tools.helpers.DeploymentHelper; import lime.tools.helpers.FileHelper; import lime.tools.helpers.HTML5Helper; +import lime.tools.helpers.IconHelper; import lime.tools.helpers.LogHelper; import lime.tools.helpers.PathHelper; import lime.tools.helpers.ProcessHelper; import lime.project.AssetType; import lime.project.HXProject; +import lime.project.Icon; import lime.project.PlatformTarget; import sys.io.File; import sys.FileSystem; @@ -179,6 +181,28 @@ class HTML5Platform extends PlatformTarget { } + context.favicons = []; + + var icons = project.icons; + + if (icons.length == 0) { + + icons = [ new Icon (PathHelper.findTemplate (project.templatePaths, "default/icon.svg")) ]; + + } + + //if (IconHelper.createWindowsIcon (icons, PathHelper.combine (destination, "favicon.ico"))) { + // + //context.favicons.push ({ rel: "icon", type: "image/x-icon", href: "./favicon.ico" }); + // + //} + + if (IconHelper.createIcon (icons, 192, 192, PathHelper.combine (destination, "favicon.png"))) { + + context.favicons.push ({ rel: "shortcut icon", type: "image/png", href: "./favicon.png" }); + + } + context.linkedLibraries = []; for (dependency in project.dependencies) { diff --git a/templates/html5/template/index.html b/templates/html5/template/index.html index feb4375e1..e1ea2cf75 100755 --- a/templates/html5/template/index.html +++ b/templates/html5/template/index.html @@ -10,6 +10,9 @@ + ::if favicons::::foreach (favicons):: + ::end::::end:: + ::if linkedLibraries::::foreach (linkedLibraries):: ::end::::end::