Skip to content

Commit

Permalink
fix build and test
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-hemphill committed Oct 29, 2023
1 parent eb46c5b commit 2676cbd
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class FaviconElement implements FaviconHtmlElement {
.filter(Boolean)
.join(" ");

return `<${this.tag} ${attrs || ""} />`;
return `<${this.tag} ${attrs || ""}>`;
}
}

Expand Down
7 changes: 1 addition & 6 deletions src/platforms/android.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
16 changes: 9 additions & 7 deletions src/platforms/favicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@ export class FaviconsPlatform extends Platform {

override async createHtml(): Promise<FaviconElement[]> {
return this.iconOptions.map(({ name, ...options }) => {
const baseEle = new FaviconElement("link", {
const baseAttrs: Record<string, string> = {
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)),
});
});
}
}
2 changes: 1 addition & 1 deletion src/platforms/windows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2676cbd

Please sign in to comment.