Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setBasePath util function to allow changing icon import path #48

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

spwoodcock
Copy link
Member

Problem

  • I am using the UI on a frontend behind a proxy, under the path /mapnow on the server.

  • I can load the JS without issues, but loading the icons I need in my app fails, as it looks for them under the normal path:
    http://MY_DOMAIN:7050/shoelace/assets/icons/map.svg
    when it should be looking under
    http://MY_DOMAIN:7050/mapnow/shoelace/assets/icons/map.svg

    My dir structure:

    image

  • Shoelace already provides a util function to handle this use case: https://shoelace.style/getting-started/installation#setting-the-base-path

  • However, because we are re-exporting shoelace, using this function as it is will not work.

Solution

  • Re-export the util function from shoelace, so we can use it like this:

    import { setBasePath } from '@hotosm/ui/dist/components';
    setBasePath('/mapnow');

@spwoodcock spwoodcock added the bug Something isn't working label Aug 9, 2024
@spwoodcock spwoodcock requested review from emi420 and JoltCode August 9, 2024 11:48
@spwoodcock spwoodcock self-assigned this Aug 9, 2024
@spwoodcock spwoodcock removed the request for review from JoltCode August 9, 2024 11:48
@spwoodcock spwoodcock merged commit 4573f40 into main Aug 22, 2024
1 of 2 checks passed
@emi420 emi420 deleted the fix/set-base-path branch September 9, 2024 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant