Navigation Menu

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

How to set location of icons svgs in deployment? (resourcesUrl) #665

Open
abierbaum opened this issue Feb 22, 2019 · 3 comments
Open

How to set location of icons svgs in deployment? (resourcesUrl) #665

abierbaum opened this issue Feb 22, 2019 · 3 comments
Labels
triage New issues

Comments

@abierbaum
Copy link

I am using ionicons with Ionic 4 and angular. I would like to change the deployment to put the ionicons svg files into a different directory than svg/. I know how to do this in angular.json but I can't figure out how to tell ionicons about the new location.

There is a resourcesUrl property inside the ion-icon component that seems to figure in [1] if I could set it. I don't understand how to set it through so all components get the setting.

Does anyone know how to override the resourcesUrl path so I can point to a different location?

1: https://github.com/ionic-team/ionicons/blob/master/src/components/icon/icon.tsx#L181

@kleeb
Copy link

kleeb commented Mar 18, 2019

any ideas other than forking ?

@objectstudio
Copy link

In need of the same capability - have some not traditional hosting I need to account for in deploying a PWA.

Any update on this?

@brandyscarney brandyscarney added the triage New issues label Sep 27, 2022
@ciekawy
Copy link

ciekawy commented Jul 1, 2023

I believe in some cases this is pretty important issue. E.g. I'm trying now to perform gradual migration of some wordpress based app into ionic and so started with embedding ionic as a page, lets say under /ionic/slug and so almost succeeded with --base-href /ionic/ and --deploy-url <dist bundle location> - unfortunately svgs used by ionic components are still tried to be loaded from /ionic/svg/. After some debugging I found that in @ionic/angular appInitialize there is a call to defineCustomElements where we could add resourcesUrl attribute which then will be passed via @ionic/core defineCustomElements from loader.js to bootstrapLazy that performs crucial setup (currently just baseURI is used):

plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;

for my specific case that will last for several weeks unless we complete the migration to ionic I'll probably stick with patch-package to just "inject" desired location, but in general this definitely would be helpful especially for some specific PWA deployments (like this https://stackoverflow.com/questions/47885451/angular-cli-build-using-base-href-and-deploy-url-to-access-assets-on-cdn).

Hope this may be useful for someone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage New issues
Projects
None yet
Development

No branches or pull requests

5 participants