1
0
Fork 0

change link to ref-competences.css

This commit is contained in:
Emmanuel Viennet 2023-05-11 18:08:02 +02:00
parent 9b73819d3b
commit 59a25c4cc3
1 changed files with 12 additions and 1 deletions

View File

@ -10,7 +10,18 @@ function getCurrentScriptPath() {
return scriptPath;
}
function removeLastTwoComponents(path) {
// Split the path into individual components
var components = path.split('/');
// Remove the last two components (filename and enclosing directory)
components.splice(-2);
// Join the remaining components back into a path
var newPath = components.join('/');
return newPath;
}
class ref_competences extends HTMLElement {
constructor() {
super();
@ -27,7 +38,7 @@ class ref_competences extends HTMLElement {
/* Style du module */
const styles = document.createElement('link');
styles.setAttribute('rel', 'stylesheet');
styles.setAttribute('href', getCurrentScriptPath() + '../css/ref-competences.css');
styles.setAttribute('href', removeLastTwoComponents(getCurrentScriptPath()) + '/css/ref-competences.css');
this.shadow.appendChild(styles);
}