Ver código fonte

feat: import svg as html

Sv443 1 ano atrás
pai
commit
af642f22bf
3 arquivos alterados com 8 adições e 1 exclusões
  1. 6 0
      global.d.ts
  2. 1 0
      src/features/menu/menu.ts
  3. 1 1
      webpack.config.js

+ 6 - 0
global.d.ts

@@ -5,6 +5,12 @@ declare module "*.html" {
   export default htmlContent;
 }
 
+declare module "*.svg" {
+  /** Content of the SVG file as a string */
+  const htmlContent: string;
+  export default htmlContent;
+}
+
 declare module "*.md" {
   /** Content of the markdown file, converted to an HTML string */
   const htmlContent: string;

+ 1 - 0
src/features/menu/menu.ts

@@ -22,6 +22,7 @@ const tabsSelectors = {
   changelog: "bytm-menu-tab-changelog",
 };
 
+/** Called from init(), before DOMContentLoaded is fired  */
 export function initMenu() {
   document.addEventListener("DOMContentLoaded", () => {
     // create menu container

+ 1 - 1
webpack.config.js

@@ -50,7 +50,7 @@ const getConfig = (env) => {
           exclude: /node_modules/,
         },
         {
-          test: /\.html$/i,
+          test: /\.(html|svg)$/i,
           loader: "html-loader",
         },
         {