I am using Webpack and Handlebars templates:
index.html
head.html
<link rel="stylesheet" href="./style.css" />
<title>...</title>
Works like a charm. Now I've added a folder next to index.html:
/index.html
/docs/index.html
Both file import the same head.html. However, the one from the docs folder will have an error in the console because the stylehsheet is not loaded. I could have solved this by passing another variable to it, e.g.:
{{> head.html webRoot="."}}
and
{{> head.html webRoot=".."}}
and change head.html to:
<link rel="stylesheet" href="{{webRoot}}/style.css" />
<title>...</title>
However, I hope to think Handlebars has some built-in variable for that. Is there any?
I am using Webpack and Handlebars templates:
index.html
head.html
Works like a charm. Now I've added a folder next to
index.html:Both file import the same
head.html. However, the one from the docs folder will have an error in the console because the stylehsheet is not loaded. I could have solved this by passing another variable to it, e.g.:and
and change
head.htmlto:However, I hope to think Handlebars has some built-in variable for that. Is there any?