Skip to content
Snippets Groups Projects
Commit ac831ef6 authored by Phil Harris's avatar Phil Harris
Browse files

Merge branch 'main' of git.cardiff.ac.uk:wmlph/socket-example

parents 1acf434b fe431f84
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,6 @@ exclude_regex = ["_templ\\.go"]
include_ext = ["templ", "go", "js", "css", "env"]
exclude_file = ["./web/public/css/styles.css"]
[log]
time = true
......
......@@ -35,7 +35,8 @@
"tailwindCSS.includeLanguages": {
"templ": "html"
},
"workbench.iconTheme": "material-icon-theme"
"workbench.iconTheme": "material-icon-theme",
"editor.lineHeight": 22
},
"extensions": [
"golang.go",
......
tmp/
.env
bin/
\ No newline at end of file
bin/
File moved
package root
import "git.cardiff.ac.uk/wmlph/socket-example/web/layouts"
import "git.cardiff.ac.uk/wmlph/socket-example/layouts"
templ (r *Root) IndexView() {
@layouts.Main() {
......
......@@ -8,7 +8,7 @@ package root
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "git.cardiff.ac.uk/wmlph/socket-example/web/layouts"
import "git.cardiff.ac.uk/wmlph/socket-example/layouts"
func (r *Root) IndexView() templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
......
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["../web/**/*.templ", "../web/**/*.go"],
content: [
"../controllers/**/*.templ",
"../controllers/**/*.go",
"../layouts/**/*.templ",
"../layouts/**/*.go"
],
theme: {
extend: {},
},
......
......@@ -12,7 +12,7 @@ templ Main() {
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Document</title>
<title>Socket skeleton</title>
<link rel="preload" href={ web.CB("/public/css/styles.css") } as="style"/>
<link rel="stylesheet" href={ web.CB("/public/css/styles.css") }/>
<script defer src={ web.CB("/public/js/alpine-collapse.min.js") }></script>
......
......@@ -35,14 +35,14 @@ func Main() templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Document</title><link rel=\"preload\" href=\"")
templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, "<!doctype html><html lang=\"en\"><head><meta charset=\"UTF-8\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"><title>Socket skeleton</title><link rel=\"preload\" href=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(web.CB("/public/css/styles.css"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/layout.templ`, Line: 16, Col: 62}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `layouts/layout.templ`, Line: 16, Col: 62}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
......@@ -55,7 +55,7 @@ func Main() templ.Component {
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(web.CB("/public/css/styles.css"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/layout.templ`, Line: 17, Col: 65}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `layouts/layout.templ`, Line: 17, Col: 65}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
......@@ -68,7 +68,7 @@ func Main() templ.Component {
var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(web.CB("/public/js/alpine-collapse.min.js"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/layout.templ`, Line: 18, Col: 66}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `layouts/layout.templ`, Line: 18, Col: 66}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil {
......@@ -81,7 +81,7 @@ func Main() templ.Component {
var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(web.CB("/public/js/alpine-persist.min.js"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/layout.templ`, Line: 19, Col: 65}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `layouts/layout.templ`, Line: 19, Col: 65}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil {
......@@ -94,7 +94,7 @@ func Main() templ.Component {
var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(web.CB("/public/js/alpine.min.js"))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/layout.templ`, Line: 20, Col: 57}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `layouts/layout.templ`, Line: 20, Col: 57}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil {
......@@ -191,7 +191,7 @@ func Main() templ.Component {
var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprint(time.Now().Year()))
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/layout.templ`, Line: 45, Col: 44}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `layouts/layout.templ`, Line: 45, Col: 44}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil {
......@@ -250,7 +250,7 @@ func sidebarLink(href string, text string) templ.Component {
var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/layout.templ`, Line: 58, Col: 105}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `layouts/layout.templ`, Line: 58, Col: 105}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil {
......@@ -301,7 +301,7 @@ func sidebarDropdownLink(href string, text string) templ.Component {
var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(text)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/layout.templ`, Line: 62, Col: 110}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `layouts/layout.templ`, Line: 62, Col: 110}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil {
......@@ -343,7 +343,7 @@ func sidebarDropdown(id, title string) templ.Component {
var templ_7745c5c3_Var17 string
templ_7745c5c3_Var17, templ_7745c5c3_Err = templ.JoinStringErrs(id)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/layout.templ`, Line: 66, Col: 13}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `layouts/layout.templ`, Line: 66, Col: 13}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var17))
if templ_7745c5c3_Err != nil {
......@@ -356,7 +356,7 @@ func sidebarDropdown(id, title string) templ.Component {
var templ_7745c5c3_Var18 string
templ_7745c5c3_Var18, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `web/layouts/layout.templ`, Line: 68, Col: 10}
return templ.Error{Err: templ_7745c5c3_Err, FileName: `layouts/layout.templ`, Line: 68, Col: 10}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var18))
if templ_7745c5c3_Err != nil {
......
package main
import (
"git.cardiff.ac.uk/wmlph/socket-example/controllers/root"
"git.cardiff.ac.uk/wmlph/socket-example/server"
"git.cardiff.ac.uk/wmlph/socket-example/web/controllers/root"
_ "github.com/joho/godotenv/autoload"
)
......
......@@ -24,6 +24,7 @@ func New() *Server {
s.Use(middleware.Logger())
s.Use(middleware.Recover())
s.Use(middleware.Gzip())
s.Use(middleware.Secure())
s.Use(CacheControl(web.PublicFS, 365*24*time.Hour, "/public/"))
return s
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment