Skip to content

Commit

Permalink
Dynamically insert the version
Browse files Browse the repository at this point in the history
  • Loading branch information
WillHannon-MCB committed Feb 8, 2024
1 parent 99cbfaa commit 2f54e70
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
21 changes: 21 additions & 0 deletions v0/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,34 @@ kbd {
background-color: var(--primary-bg-color);
}

.github-link .icon {
width: 30px;
height: 30px;
}

.github-link a {
display: flex;
align-items: center;
text-decoration: none;
color: rgba(0, 0, 0, 0.75);
}

.software-version {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
padding: 1px;
box-sizing: border-box;
background-color: var(--primary-bg-color);
}

.software-version span {
display: flex;
color: rgba(44, 44, 44, 0.75);
font-size: small;
}

.alert {
padding: 15px;
margin-bottom: 20px;
Expand Down
10 changes: 10 additions & 0 deletions v0/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ <h1 class="logo">
</div>
</a>
</div>
<!-- Software Version -->
<div class="software-version">
<span></span>
</div>
</div>
<!-- Main container with plot and protein content -->
<div class="main" id="main">
Expand Down Expand Up @@ -406,5 +410,11 @@ <h1 class="logo">
</div>
</div>
<script type="module" src="./js/main.js"></script>
<script type="module">
document.addEventListener("DOMContentLoaded", () => {
const versionElement = document.querySelector(".software-version span");
versionElement.textContent = `${__APP_VERSION__}`;
});
</script>
</body>
</html>
11 changes: 9 additions & 2 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
export default {
import { defineConfig } from "vite";
import { version } from "./package.json";

export default defineConfig({
build: {
rollupOptions: {
input: {
Expand All @@ -7,4 +10,8 @@ export default {
},
},
},
};
define: {
// Pass the app version from package.json to the app
__APP_VERSION__: JSON.stringify(version),
},
});

0 comments on commit 2f54e70

Please sign in to comment.