From 0036a6ddca80062568c9d4fd6407b3a805bdc886 Mon Sep 17 00:00:00 2001 From: Victor Lacasse-Beaudoin Date: Tue, 21 Mar 2023 19:59:41 -0400 Subject: [PATCH] Ajouter stylesheet /static/index.css pour / MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Déplacer public/scss vers public/css Ajouter public/css/index.css comme stylesheet pour / Ajouter route /static/index.css comme Blob text/css --- public/css/index.css | 3 +++ public/html/index.gohtml | 4 +--- public/public.go | 2 +- public/scss/index.scss | 0 server.go | 10 ++++++++++ 5 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 public/css/index.css delete mode 100644 public/scss/index.scss diff --git a/public/css/index.css b/public/css/index.css new file mode 100644 index 0000000..e28c912 --- /dev/null +++ b/public/css/index.css @@ -0,0 +1,3 @@ +body { + text-align: center; +} diff --git a/public/html/index.gohtml b/public/html/index.gohtml index 329c882..ca20955 100644 --- a/public/html/index.gohtml +++ b/public/html/index.gohtml @@ -4,9 +4,7 @@ AGECEM - +

Association Générale Étudiante du Cégep Édouard-Montpetit

diff --git a/public/public.go b/public/public.go index 92df5a0..60d9fe6 100644 --- a/public/public.go +++ b/public/public.go @@ -2,7 +2,7 @@ package public import "embed" -//go:embed html/* scss/* js/* +//go:embed html/* css/* js/* var embedFS embed.FS func GetEmbedFS() embed.FS { diff --git a/public/scss/index.scss b/public/scss/index.scss deleted file mode 100644 index e69de29..0000000 diff --git a/server.go b/server.go index 93861fe..09cebfb 100644 --- a/server.go +++ b/server.go @@ -46,6 +46,7 @@ func Execute() { // HTML Routes e.GET("/", handleIndex) + e.GET("/static/index.css", handleStaticCSSIndex) e.Logger.Fatal(e.Start(":8080")) } @@ -69,3 +70,12 @@ func handleV1(c echo.Context) error { func handleIndex(c echo.Context) error { return c.Render(http.StatusOK, "index-html", nil) } + +// CSS Handlers + +func handleStaticCSSIndex(c echo.Context) error { + // TODO Ajouter gestion d'erreurs + // TODO Ajouter support pour fichiers SCSS + data, _ := embedFS.ReadFile("css/index.css") + return c.Blob(http.StatusOK, "text/css", data) +} -- 2.45.2