diff --git a/src/index.ts b/src/index.ts index f8ae98ee..9fc2ef05 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,7 +42,7 @@ export class FaviconElement implements FaviconHtmlElement { .filter(Boolean) .join(" "); - return `<${this.tag} ${attrs || ""} />`; + return `<${this.tag} ${attrs || ""}>`; } } diff --git a/src/platforms/android.ts b/src/platforms/android.ts index 35773a97..dd7da349 100644 --- a/src/platforms/android.ts +++ b/src/platforms/android.ts @@ -1,10 +1,5 @@ import escapeHtml from "escape-html"; -import { - FaviconElement, - FaviconFile, - FaviconElement, - FaviconImage, -} from "../index"; +import { FaviconElement, FaviconFile, FaviconImage } from "../index"; import { FaviconOptions, IconOptions, diff --git a/src/platforms/favicons.ts b/src/platforms/favicons.ts index 70cbcea0..591f2bbb 100644 --- a/src/platforms/favicons.ts +++ b/src/platforms/favicons.ts @@ -21,20 +21,22 @@ export class FaviconsPlatform extends Platform { override async createHtml(): Promise { return this.iconOptions.map(({ name, ...options }) => { - const baseEle = new FaviconElement("link", { + const baseAttrs: Record = { rel: "icon", type: "image/png", - href: this.cacheBusting(this.relative(name)), - }); + }; if (name.endsWith(".ico")) { - baseEle.attrs.type = "image/x-icon"; + baseAttrs.type = "image/x-icon"; } else if (name.endsWith(".svg")) { - baseEle.attrs.type = "image/svg+xml"; + baseAttrs.type = "image/svg+xml"; } else { const { width, height } = options.sizes[0]; - baseEle.attrs.sizes = `${width}x${height}`; + baseAttrs.sizes = `${width}x${height}`; } - return baseEle; + return new FaviconElement("link", { + ...baseAttrs, + href: this.cacheBusting(this.relative(name)), + }); }); } } diff --git a/src/platforms/windows.ts b/src/platforms/windows.ts index 080597a0..db98423e 100644 --- a/src/platforms/windows.ts +++ b/src/platforms/windows.ts @@ -48,7 +48,7 @@ export class WindowsPlatform extends Platform { return [ new FaviconElement("meta", { - name: "msapplication-TileImage", + name: "msapplication-TileColor", content: this.options.background, }), this.iconOptions.find((iconOption) => iconOption.name === tile)