Closed spwoodcock closed 4 months ago
For the CDN usage https://cdn.jsdelivr.net/npm/@hotosm/ui@latest/dist/components.js
I have made use of setBasePath to use the bundled CDN icons https://cdn.jsdelivr.net/npm/@hotosm/ui@latest/dist/assets/icons/xxx.svg
, so this should work without configuration when importing in HTML / Markdown etc.
When using the library with a bundler (i.e. developing an app with a framework), the icon assets must be copied manually into the final bundle. Info in the readme/docs.
Update: I hardcoded the icons we use in the library in a .ts
file and registered as an extra icon pack with shoelace sl-icon
.
To use we need to: <sl-icon library="bundled" icon="icon-name"></sl-icon>
Add new icons to theme/icons/bundled.ts
to use.
This is the same way that shoelace bundles some essential system icons.
Describe the bug
components.js
bundle this doesn't work. The icons are there, but thesetBasePath
method is not called to load from our package.Possible solutions
Option 1: Could we import the
setBasePath
method:And then re-export it from the hotosm/ui package, to prevent having to install shoelace directly?
Option 2: Bundle the icons another way somehow.
Additional context Add any other context about the problem here.