Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SUBFOLDER as asset base to allow mounting homer at a different base path. #694

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ dockerfile
.git
screenshot.png
node_modules
dummy-data
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# build stage
FROM node:lts-alpine as build-stage

ARG SUBFOLDER ""

WORKDIR /app

COPY package*.json ./
Expand Down
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default {

if (this.currentPage !== "default") {
let pageConfig = await this.getConfig(
`assets/${this.currentPage}.yml`
`${import.meta.env.BASE_URL}/assets/${this.currentPage}.yml`
);
config = Object.assign(config, pageConfig);
}
Expand All @@ -230,7 +230,7 @@ export default {
this.createStylesheet(stylesheet);
}
},
getConfig: function (path = "assets/config.yml") {
getConfig: function (path = `${import.meta.env.BASE_URL}/assets/config.yml`) {
return fetch(path).then((response) => {
if (response.status == 404 || response.redirected) {
this.configNotFound = true;
Expand Down
2 changes: 1 addition & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import vue from "@vitejs/plugin-vue";

// https://vitejs.dev/config/
export default defineConfig({
base: "",
base: process.env.SUBFOLDER ?? "",
build: {
assetsDir: "resources",
},
Expand Down