From a90e2f2b1a934db9c43c21d08cd42e1f6b460fca Mon Sep 17 00:00:00 2001 From: Yohany Flores Suarez Date: Tue, 14 Jan 2020 22:21:43 -0500 Subject: [PATCH] CSS static resources url to file path mappings --- Dockerfile | 1 + main.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 4471e71..ef90308 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ RUN wget -q https://github.com/benweet/stackedit/archive/${STACKEDIT_VERSION}.ta RUN npm install RUN npm audit fix ENV NODE_ENV=production +RUN sed -i "s/assetsPublicPath: '\/',/assetsPublicPath: '.\/',/g" config/index.js && cat config/index.js RUN npm run build FROM scratch AS final diff --git a/main.go b/main.go index 5ebda69..d2ddb94 100644 --- a/main.go +++ b/main.go @@ -62,9 +62,13 @@ func main() { case "/oauth2/callback": filepath = "/static/oauth2/callback.html" case "/app", "/app/": - filepath = "/dist/" + filepath = "/dist/index.html" default: switch { + case strings.HasPrefix(urlStackeditPath, "/static/css/static/fonts/"): + filepath = "/dist/" + strings.TrimPrefix(urlStackeditPath, "/static/css/") + case strings.HasPrefix(urlStackeditPath, "/app/static/css/static/fonts/"): + filepath = "/dist/" + strings.TrimPrefix(urlStackeditPath, "/app/static/css/") case strings.HasPrefix(urlStackeditPath, "/app/"): filepath = "/dist/" + strings.TrimPrefix(urlStackeditPath, "/app/") }