Merge pull request 'Ajouter stylesheet /static/index.css pour /' (#20) from feature/css into main

Reviewed-on: #20
This commit is contained in:
Victor Lacasse-Beaudoin 2023-03-21 19:04:13 -05:00
commit aab1dd5a62
5 changed files with 15 additions and 4 deletions

3
public/css/index.css Normal file
View file

@ -0,0 +1,3 @@
body {
text-align: center;
}

View file

@ -4,9 +4,7 @@
<head>
<meta charset="utf-8">
<title>AGECEM</title>
<style>
body {text-align: center;}
</style>
<link rel="stylesheet" href="static/index.css">
</head>
<body>
<h1>Association Générale Étudiante du Cégep Édouard-Montpetit</h1>

View file

@ -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 {

View file

View file

@ -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)
}