drizzle
drizzle copied to clipboard
Using baseurl in patterns
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" />
@yodasw16 What path output do you get when using just {{baseurl}}/assets/...
without the @root
?
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).
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.