I'm trying to deploy my project site on gh-pages, it's angular2 app with webpack, I set the base url to my repo name and everything loads fine except the relative paths in the templates, here is what I mean
import {Component} from '@angular/core';
@Component({
selector: 'header',
template: `
<img class="fb-logo" [src]="fbLogo"/>
<img class="ang-logo" [src]="angularLogo"/>
`
})
export class Header{
angularLogo = '../../assets/img/angular-logo.png';
fbLogo = '../../assets/img/share/facebook.svg';
}
This works well on local dev, but when I push it to gh-pages
branch It gives 404 because it's trying to get it from the root server http://myAcc.github.io/assets/img/fbLogo.svg
instead of http://myAcc.github.io/myRepo/assets/img/fbLogo.svg
I couldn't figure out how to fix it so I tried to use it as inline-svg using require
angularLogo = require('../../assets/img/angular-logo.png');
fbLogo = require('../../assets/img/share/facebook.svg');
it works fine on local (with xss warnings) but when I deploy it to gh-pages
It refuses to run over https.
How can I fix this issue?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…