Ajouter stylesheet /static/index.css pour / #20

Merged
vlbeaudoin merged 1 commit from feature/css into main 2023-03-21 20:04:14 -04:00
5 changed files with 15 additions and 4 deletions
Showing only changes of commit 0036a6ddca - Show all commits

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