Skip to content

Docs: fix local assets path handling for Windows compatibility#41485

Merged
julien-deramond merged 2 commits intomainfrom
main-lmp-change-astro-windows
May 25, 2025
Merged

Docs: fix local assets path handling for Windows compatibility#41485
julien-deramond merged 2 commits intomainfrom
main-lmp-change-astro-windows

Conversation

@louismaximepiton
Copy link
Member

@louismaximepiton louismaximepiton commented May 23, 2025

Description & Motivation & Context

On Windows, I had some troubles having the examples working with extraCss or extraJs working on local. The solution was to add some \ in the path regex and it works fine on my side now.

Here is the rendering I have on main when I want to acces to the grid example:
image

Here is the trace I have in the terminal:

09:49:31 [ERROR] Failed to get example asset path from path: '**\bootstrap\site\src\assets\examples\badges\badges.css'.
  Stack trace:
    at sanitizeAssetPath (**\bootstrap\site\src\libs\examples.ts:64:11)
    at getExamplesAssetsRecursively (**\bootstrap\site\src\libs\examples.ts:53:7)
    at Module.getStaticPaths (**\bootstrap\site\src\pages\docs\[version]\examples\[...asset].ts:10:26)
    [...] See full stack trace in the browser, or rerun with --verbose.

with the change, it behaves correctly.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

NA

@github-project-automation github-project-automation bot moved this to To do in v5.3.7 May 23, 2025
@julien-deramond julien-deramond moved this from To do to Needs review in v5.3.7 May 23, 2025
@julien-deramond julien-deramond self-requested a review May 25, 2025 12:14
Copy link
Member

@julien-deramond julien-deramond left a comment

Choose a reason for hiding this comment

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

I don't have a Windows machine to test the before/after scenario myself, but I trust your judgment; Boosted uses the exact same configuration as Bootstrap.

The fix is minimal and specifically targets Windows compatibility. I’ve tested running the server locally, and compared the generated _site directory after running npm run docs; it’s identical, so there appears to be no impact from your change.

LGTM, let’s go ahead with it!

@julien-deramond julien-deramond changed the title Docs: Local assets working for Windows Docs: fix local assets path handling for Windows compatibility May 25, 2025
@julien-deramond julien-deramond merged commit d6ca5ba into main May 25, 2025
14 checks passed
@julien-deramond julien-deramond deleted the main-lmp-change-astro-windows branch May 25, 2025 12:20
@github-project-automation github-project-automation bot moved this from Needs review to Done in v5.3.7 May 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants