I have a webcomponent where i need to add a link
tag to the head and set the href
equal to a folder inside that node module.
Right now im in the building phase of this component where my structure look like this:
So i need to add the fontawsome.css
script to the head of my page. ive created the following script:
constructor() {
super();
if (!this.isFontAwesomeLoaded()) {
this.iclass = '';
const fontEl = document.createElement('link');
fontEl.rel = 'stylesheet';
fontEl.href = "./fontawesome/css/all.css";
document.head.appendChild(fontEl);
}
}
Now there is a problem with this the path ./fontawesome/css/all.css
wont work when it hits the head
tag because the index.html
file that attempts to load it doesnt have the folder in its project. instead when it hits product it needs to find the absoulte path to my module and then to the fontawesome
folder.
My question is how can i get that path?
from Getting path to file in published webcomponent
No comments:
Post a Comment