diff --git a/frontend/assets/css/style.css b/frontend/assets/css/dashboard.css similarity index 100% rename from frontend/assets/css/style.css rename to frontend/assets/css/dashboard.css diff --git a/frontend/handler.go b/frontend/handler.go index 4c731de..31043ae 100644 --- a/frontend/handler.go +++ b/frontend/handler.go @@ -3,6 +3,8 @@ package frontend import ( "html/template" "net/http" + "path/filepath" + "strings" ) var dashbaord = template.Must(template.ParseFiles( @@ -33,3 +35,8 @@ func Dashboard(w http.ResponseWriter, r *http.Request) { return } } + +func Assets(w http.ResponseWriter, r *http.Request) { + path := strings.TrimPrefix(r.URL.Path, "/assets/") + http.ServeFile(w, r, filepath.Join("frontend/assets", path)) +} diff --git a/frontend/htmx/contents/dash/base.html b/frontend/htmx/contents/dash/base.html index 0e4adac..9da79d1 100644 --- a/frontend/htmx/contents/dash/base.html +++ b/frontend/htmx/contents/dash/base.html @@ -7,7 +7,7 @@ - + diff --git a/server/server.go b/server/server.go index 776ec2b..074df20 100644 --- a/server/server.go +++ b/server/server.go @@ -77,6 +77,9 @@ func (this *Server) Run() { mux.HandleFunc("/api/stock/add", handlers.AddStock) mux.HandleFunc("/api/project-items/add", handlers.AllocateToProject) + // Assets + mux.HandleFunc("/assets/", frontend.Assets) + // Login required // Admin-only