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

Using baseurl in patterns #91

Open
yodasw16 opened this issue Oct 21, 2016 · 3 comments
Open

Using baseurl in patterns #91

yodasw16 opened this issue Oct 21, 2016 · 3 comments

Comments

@yodasw16
Copy link

I saw in the default template {{@root.baseurl}} so I tried to use it in a pattern to point to icons that I added to the assets directory. Using it here adds an extra ../. From what I can tell this happens because @root is the initial context that the template was executed in. Is there a way to use this in a pattern that I am just not seeing or do I have to hard code the directory levels?

I'm using it like this:
<use xlink:href="{{@root.baseurl}}/assets/toolkit/images/icons.svg#{{icon}}" />

and getting
<use xlink:href="../../../assets/toolkit/images/icons.svg#bell" />

when I should get
<use xlink:href="../../assets/toolkit/images/icons.svg#bell" />

@erikjung
Copy link
Contributor

@yodasw16 What path output do you get when using just {{baseurl}}/assets/... without the @root?

@yodasw16
Copy link
Author

Same, I still get ../../../

Another thing that is very weird about it is that I didn't notice an issue until pushing it to gh-pages. In dev, even though the path is wrong, the icon shows up. Once I run gulp demo and view it there the images don't load (which they shouldn't based on the path).

@CapsE
Copy link

CapsE commented Apr 7, 2020

Same Problem here. Did you ever manage to fix this?

EDIT:
I found out that the "getBaseUrl" function in utils/context.js considers the complete path to html files when creating the relative url. But patterns will be grouped in drizzle and displayed on a single html page. So while the path might be correct for the source files it doesn't consider the rendered files.

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

No branches or pull requests

3 participants