Skip to content

Commit

Permalink
Minimize HTML changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GregBrimble committed Sep 19, 2024
1 parent a954aa4 commit cb9f9dd
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 5 deletions.
9 changes: 9 additions & 0 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,13 @@ export default defineConfig({
},
}),
],
vite: {
build: {
rollupOptions: {
output: {
entryFileNames: "_astro/[name].js",
},
},
},
},
});
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@types/node": "^20.16.1",
"algoliasearch": "^4.24.0",
"astro": "^4.15.5",
"astro-breadcrumbs": "^2.3.1",
"astro-breadcrumbs": "^3.1.0",
"astro-icon": "^1.1.1",
"astro-live-code": "^0.0.3",
"date-fns": "^3.6.0",
Expand Down
44 changes: 44 additions & 0 deletions patches/astro-breadcrumbs+3.1.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/node_modules/astro-breadcrumbs/src/Breadcrumbs.astro b/node_modules/astro-breadcrumbs/src/Breadcrumbs.astro
index b4a60ee..25fc657 100644
--- a/node_modules/astro-breadcrumbs/src/Breadcrumbs.astro
+++ b/node_modules/astro-breadcrumbs/src/Breadcrumbs.astro
@@ -28,12 +28,12 @@ const {
excludeCurrentPage = false,
debug = false,
separatorAriaHidden = true,
+ id = crypto.randomUUID(),
} = Astro.props as BreadcrumbsProps;

const paths = Astro.url.pathname.split("/").filter((crumb: any) => crumb);
const hasTrailingSlash = Astro.url.pathname.endsWith("/");
const pathLength = paths?.length;
-const UUID = crypto.randomUUID();
const listCssClasses = [
`${mainBemClass}__crumbs`,
Astro.slots.has("separator") ? " has-separators" : " has-no-separators",
@@ -63,11 +63,11 @@ debugInformation(debug, parts, customizedParts);

<astro-breadcrumbs
data-main-bem-class={mainBemClass}
- data-id={UUID}
+ data-id={id}
data-path-length={pathLength}
data-truncated={truncated}
>
- <nav aria-label={ariaLabel} class={mainBemClass} id={UUID} {...customizeNav}>
+ <nav aria-label={ariaLabel} class={mainBemClass} id={id} {...customizeNav}>
<ol class:list={listCssClasses} {...customizeList}>
{
processedParts.map(
diff --git a/node_modules/astro-breadcrumbs/src/breadcrumbs.types.ts b/node_modules/astro-breadcrumbs/src/breadcrumbs.types.ts
index 019011e..5459a37 100644
--- a/node_modules/astro-breadcrumbs/src/breadcrumbs.types.ts
+++ b/node_modules/astro-breadcrumbs/src/breadcrumbs.types.ts
@@ -15,6 +15,7 @@ export interface BreadcrumbsProps {
excludeCurrentPage?: boolean;
debug?: boolean;
separatorAriaHidden?: boolean;
+ id?: string;
}

export interface CustomizeElement extends AddAttributes {
1 change: 1 addition & 0 deletions src/components/overrides/PageTitle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const breadcrumbProps: Record<string, any> = {
},
],
truncated: true,
id: "breadcrumbs",
};
const slug = Astro.props.entry.slug;
Expand Down

0 comments on commit cb9f9dd

Please sign in to comment.