From e9fc659a5ab3bf87668ffbfb0dc5ac3393efe297 Mon Sep 17 00:00:00 2001 From: ange Date: Sat, 14 Dec 2024 08:34:47 +0000 Subject: [PATCH 1/4] feat: html static templates --- Dockerfile | 9 ++++---- compose.yaml | 7 ++++-- html/about.html | 33 ---------------------------- html/{index.html => contact.html} | 36 +++---------------------------- html/resume.html | 22 ++----------------- src/main.go | 5 ++--- src/route.go | 3 ++- src/tmpl.go | 29 +++++++++++++++++++++++++ src/views.go | 12 +++++++---- static/copy.js | 13 +++++++++++ tmpl/head.tmpl | 5 +++++ tmpl/header.tmpl | 17 +++++++++++++++ 12 files changed, 91 insertions(+), 100 deletions(-) delete mode 100644 html/about.html rename html/{index.html => contact.html} (66%) create mode 100644 src/tmpl.go create mode 100644 static/copy.js create mode 100644 tmpl/head.tmpl create mode 100644 tmpl/header.tmpl diff --git a/Dockerfile b/Dockerfile index 15c4832..5d5cc42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,8 +6,9 @@ COPY src/ . RUN CGO_ENABLED=0 go build -o /app FROM scratch -COPY --from=build /app /app -COPY static/ /static/ -COPY html/ /html/ +COPY --from=build /app . +COPY html/ html/ +COPY static/ static/ +COPY tmpl/ tmpl/ EXPOSE 3000 -CMD ["/app"] +CMD ["./app"] diff --git a/compose.yaml b/compose.yaml index 001d041..6ebda20 100644 --- a/compose.yaml +++ b/compose.yaml @@ -10,7 +10,10 @@ services: path: src/ - action: sync+restart path: html/ - target: html + target: html/ + - action: sync+restart + path: tmpl/ + target: tmpl/ - action: sync path: static/ - target: static + target: static/ diff --git a/html/about.html b/html/about.html deleted file mode 100644 index 1af3590..0000000 --- a/html/about.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - Ange DUHAYON - - - - - -
- -
-
-
- - diff --git a/html/index.html b/html/contact.html similarity index 66% rename from html/index.html rename to html/contact.html index 2cb9f76..dff8dc9 100644 --- a/html/index.html +++ b/html/contact.html @@ -1,41 +1,11 @@ - - Ange DUHAYON - - + {{template "head.tmpl" .}} - - + + {{template "header.tmpl" .}}
- - source - -
+ {{template "header.tmpl". }}