{ post.Title }
++ { post.Excerpt } + read more... +
+diff --git a/Makefile b/Makefile
index 1d5534f..e9c1bac 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,7 @@
# Go parameters
GOCMD=go
TEMPL=templ
+TAILWIND=tailwindcss-linux-x64
BUILD_DIR=./tmp
URCHIN_DIR=./cmd/urchin
URCHIN_ADMIN_DIR=./cmd/urchin-admin
@@ -13,6 +14,9 @@ all: build test
build:
$(TEMPL) generate
+ $(TAILWIND) -i ./static/style.css -o ./static/output.css -m
+ $(GOCMD) build -v -o $(BUILD_DIR)/$(BINARY_NAME) $(URCHIN_DIR)
+ $(GOCMD) build -v -o $(BUILD_DIR)/$(ADMIN_BINARY_NAME) $(URCHIN_ADMIN_DIR)
GIN_MODE=release $(GOCMD) build -ldflags "-s" -v -o $(BUILD_DIR)/$(BINARY_NAME) $(URCHIN_DIR)
GIN_MODE=release $(GOCMD) build -ldflags "-s" -v -o $(BUILD_DIR)/$(ADMIN_BINARY_NAME) $(URCHIN_ADMIN_DIR)
diff --git a/app/app.go b/app/app.go
index c74adbf..758469a 100644
--- a/app/app.go
+++ b/app/app.go
@@ -5,10 +5,12 @@ import (
"net/http"
"time"
+ "github.com/a-h/templ"
"github.com/gin-gonic/gin"
"github.com/matheusgomes28/urchin/common"
"github.com/matheusgomes28/urchin/database"
"github.com/matheusgomes28/urchin/views"
+ "github.com/matheusgomes28/urchin/views/tailwind"
"github.com/rs/zerolog/log"
)
@@ -20,6 +22,8 @@ func SetupRoutes(app_settings common.AppSettings, database database.Database) *g
r := gin.Default()
r.MaxMultipartMemory = 1
+ r.GET("/tailwind", makeHomeHandler(app_settings, database, tailwind.MakeIndex))
+
// All cache-able endpoints
cache := MakeCache(4, time.Minute*10, &TimeValidator{})
addCachableHandler(r, "GET", "/", homeHandler, &cache, app_settings, database)
@@ -33,6 +37,7 @@ func SetupRoutes(app_settings common.AppSettings, database database.Database) *g
return r
}
+
func addCachableHandler(e *gin.Engine, method string, endpoint string, generator Generator, cache *Cache, app_settings common.AppSettings, db database.Database) {
handler := func(c *gin.Context) {
@@ -45,6 +50,7 @@ func addCachableHandler(e *gin.Engine, method string, endpoint string, generator
// Before handler call (retrieve from cache)
html_buffer, err := generator(c, app_settings, db)
+
if err != nil {
log.Error().Msgf("could not generate html: %v", err)
// TODO : Need a proper error page
@@ -55,6 +61,7 @@ func addCachableHandler(e *gin.Engine, method string, endpoint string, generator
return
}
+
// After handler (add to cache)
err = (*cache).Store(c.Request.RequestURI, html_buffer)
if err != nil {
diff --git a/tailwind.config.js b/tailwind.config.js
new file mode 100644
index 0000000..2ca95ae
--- /dev/null
+++ b/tailwind.config.js
@@ -0,0 +1,12 @@
+/** @type {import('tailwindcss').Config} */
+module.exports = {
+ content: ["./**/*.templ"],
+ theme: {
+ extend: {},
+ fontFamily: {
+ 'roboto': ['Roboto', 'sans-serif'],
+ 'bangers': ['Bangers', 'sans-serif'],
+ }
+ },
+ plugins: [],
+}
diff --git a/views/tailwind/footer.templ b/views/tailwind/footer.templ
new file mode 100644
index 0000000..71c5432
--- /dev/null
+++ b/views/tailwind/footer.templ
@@ -0,0 +1,5 @@
+package tailwind
+
+templ MakeFooter() {
+
+}
diff --git a/views/tailwind/header.templ b/views/tailwind/header.templ
new file mode 100644
index 0000000..b84f014
--- /dev/null
+++ b/views/tailwind/header.templ
@@ -0,0 +1,33 @@
+package tailwind
+
+type Link struct {
+ Href string
+ Name string
+}
+
+templ MakeNavBar(links []Link) {
+
+}
\ No newline at end of file
diff --git a/views/tailwind/index.templ b/views/tailwind/index.templ
new file mode 100644
index 0000000..0d86c42
--- /dev/null
+++ b/views/tailwind/index.templ
@@ -0,0 +1,42 @@
+package tailwind
+
+import (
+ "fmt"
+ . "github.com/matheusgomes28/common"
+)
+
+templ MakeIndex(posts []Post) {
+
+
+
+ // This should go into Make HTML Headers
+
+ { post.Excerpt } + read more... +
+