I have a blazor application which is being hosted on GitHub pages.
This is the index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Bitcoin Challenge Blazor App</title>
<base href="/BitcoinChallengeBlazor/" />
<link href="css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
</head>
<body>
<app>Loading...</app>
<div id="blazor-error-ui">
An unhandled error has occurred.
<a href="" class="reload">Reload</a>
<a class="dismiss">π</a>
</div>
<script src="_framework/blazor.webassembly.js"></script>
</body>
</html>
On GitHub pages, the base needs to be <base href="/BitcoinChallengeBlazor/" />
.
However, when developing locally, the base needs to be <base href="/" />
.
In theory, I could just change it and tell git that this change belongs to a different changeset.
But it seems to me there should be a better way to do this which will include the correct value according to the environment, possibly using launchSettings.json
or appsettings.json
.
... but it's not obvious to me how I could make values from either/both of those files available in that exact context.
Any ideas?
<base href
tag when deploy on an env. Maybe tool like Octopus deploy can do that or a github action. Or create each index.html per env. and choose the good one for the dest env on deploy by replacing index.html with a script. β Idioglossia