diff --git a/index.html b/index.html
index 6315107..e681d0b 100644
--- a/index.html
+++ b/index.html
@@ -24,20 +24,20 @@
diff --git a/vite.config.ts b/vite.config.ts
index de517dc..fe04c77 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,20 +1,20 @@
/* eslint-disable import/no-extraneous-dependencies */
import * as fs from "fs";
+import { globSync } from "glob";
import * as path from "path";
import { defineConfig } from "vite";
-import { globSync } from "glob";
import * as fragmentsPackageJson from "./packages/fragments/package.json";
const writeIndexHTML = () => {
let links: string = "";
const examplePaths = globSync("packages/**/src/**/example*.html");
for (const examplePath of examplePaths) {
- const directory = path.dirname(examplePath);
- const packageNameMatch = directory.match(/packages\\([^\\]+)/);
- if (!(packageNameMatch && packageNameMatch.length > 1)) continue;
- const packageName = packageNameMatch[1];
- const exampleName = path.basename(directory);
- links += `${packageName}/${exampleName}\n`;
+ const directorySegments = path.dirname(examplePath).split(path.sep);
+ const packageName = directorySegments
+ .slice(1, directorySegments.indexOf("src"))
+ .join("/");
+ const exampleName = directorySegments[directorySegments.length - 1];
+ links += `${packageName}/${exampleName}\n`;
}
const index = `