mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-09 03:24:13 +00:00
Fix issue with wrong base-href for github.io
This commit is contained in:
parent
b0461d69ea
commit
6286980327
@ -29,7 +29,8 @@
|
||||
"dev": "environments/environment.ts",
|
||||
"prod": "environments/environment.prod.ts",
|
||||
"electronProd": "environments/environment.electron.prod.ts",
|
||||
"electronDev": "environments/environment.electron.ts"
|
||||
"electronDev": "environments/environment.electron.ts",
|
||||
"githubProd": "environments/environment.github.prod.ts"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -55,7 +55,7 @@ after_script:
|
||||
# greenkeeper-lockfile support
|
||||
- greenkeeper-lockfile-upload
|
||||
# publish on gns3.github.io
|
||||
- yarn ng build --base-href /${TRAVIS_BRANCH}/
|
||||
- yarn buildforgithub --base-href /${TRAVIS_BRANCH}/
|
||||
- export GIT_LAST_LOG="$(git log -1 --pretty=%B)"
|
||||
- git clone https://${GITHUB_CREDENTIALS}@github.com/GNS3/gns3.github.io.git github-pages
|
||||
- mkdir -p github-pages/${TRAVIS_BRANCH}
|
||||
|
@ -13,6 +13,7 @@
|
||||
"startforelectron": "ng serve -e electronDev",
|
||||
"build": "ng build",
|
||||
"buildforelectron": "ng build -e electronProd",
|
||||
"buildforgithub": "ng build -e githubProd",
|
||||
"test": "ng test",
|
||||
"lint": "ng lint",
|
||||
"e2e": "ng e2e",
|
||||
|
5
src/environments/environment.github.prod.ts
Normal file
5
src/environments/environment.github.prod.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export const environment = {
|
||||
production: true,
|
||||
electron: false,
|
||||
githubio: true
|
||||
};
|
@ -5,5 +5,6 @@
|
||||
|
||||
export const environment = {
|
||||
production: false,
|
||||
electron: false
|
||||
electron: false,
|
||||
githubio: false
|
||||
};
|
||||
|
@ -3,15 +3,20 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>GNS3 Web UI Demo</title>
|
||||
<!-- It's important to have base here because of the script below //-->
|
||||
<base href="/">
|
||||
|
||||
<script>
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
// in case we're running in electron because we need it for resources
|
||||
if (userAgent.indexOf(' electron/') > -1) {
|
||||
document.write('<base href="' + document.location + '" />');
|
||||
}
|
||||
// in case base href is not set, when not defined during the build time (for instance github.io pages)
|
||||
else if (document.getElementsByTagName('base').length == 0) {
|
||||
document.write('<base href="/" />');
|
||||
var base = document.getElementsByTagName('base');
|
||||
if(base.length > 0) {
|
||||
base.href = document.location;
|
||||
}
|
||||
else {
|
||||
document.write('<base href="' + document.location + '" />');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user