Skip to content

Conversation

DiegoCardoso
Copy link
Contributor

Description

Add a similar index.html page that is available in /dev/index.html to /dev/charts/ to make it easier to move between charts dev pages.

Add a similar `index.html` page that is available in `/dev/index.html`
to `/dev/charts/` to make it easier to move between charts dev pages.
@@ -78,6 +78,8 @@ export default {
// Index page listing
if (['/dev/index.html', '/dev', '/dev/'].includes(context.path)) {
body = generateListing(body, './dev', context.path);
} else if (['/dev/charts/index.html', '/dev/charts', '/dev/charts/'].includes(context.path)) {
body = generateListing(body, './dev/charts', context.path);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also update code in generateListing to add <base href> tag for /dev/charts without trailing slash to make sure relative import for common.js works properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. I refactored it a bit to use regex to avoid duplicating the same logic. Let me know what you think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but we also need to update this now to get correct listing when running yarn dev:start:

transformHtml: [(html) => appendStyles(html), (html) => generateListing(html)],

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried something, but it is not working well when the URL has a trailing slash (http://localhost:8000/charts/) because the links in the listing end up with .../charts/charts/... 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. IMO we can accept that /charts would not work and then just allow /charts/ and /charts/index.html.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed logic for writing <base> for dev pages build (but preserved it for running yarn start).
Also modified generateListing() to list "charts" as a separate entry in the main index.html.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Copy link

@web-padawan web-padawan merged commit a521b1a into main Aug 15, 2025
9 checks passed
@web-padawan web-padawan deleted the chore/dev/charts-list branch August 15, 2025 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants