-
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: load images from the correct path when the Pact Broker applicati…
…on is run from a non root context
- Loading branch information
Showing
8 changed files
with
59 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
Set the base URL of the background images | ||
so they load from the right path when the base | ||
URL of the app is not / | ||
Must be loaded after the css but before any of the elements have started to render. | ||
*/ | ||
|
||
function setCssAssetBaseUrl(base_url, varName) { | ||
const urlVar = getComputedStyle(document.documentElement).getPropertyValue(varName) | ||
if (urlVar) { | ||
const absoluteUrlVar = urlVar.replace(/\//, (base_url + '/')); | ||
const root = document.querySelector(':root'); | ||
root.style.setProperty(varName, absoluteUrlVar); | ||
} | ||
} | ||
|
||
setCssAssetBaseUrl(BASE_URL, '--kebab-url'); | ||
setCssAssetBaseUrl(BASE_URL, '--pact-kebab-url'); | ||
setCssAssetBaseUrl(BASE_URL, '--clock-url'); | ||
setCssAssetBaseUrl(BASE_URL, '--arrow-switch-url'); | ||
setCssAssetBaseUrl(BASE_URL, '--alert-url'); | ||
setCssAssetBaseUrl(BASE_URL, '--copy-url'); | ||
setCssAssetBaseUrl(BASE_URL, '--check-url'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters