diff options
author | Simon Ser <contact@emersion.fr> | 2019-12-16 12:57:30 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2019-12-16 12:58:21 +0100 |
commit | e93346ffa90f6c09a9a57b48c6607925dc7ff46e (patch) | |
tree | 5e1f356017c763a604cc8bcf247759037ae51d74 | |
parent | d897eeee5c4d163891d0b6a8f85d328ccada7575 (diff) | |
download | alps-e93346ffa90f6c09a9a57b48c6607925dc7ff46e.tar.gz alps-e93346ffa90f6c09a9a57b48c6607925dc7ff46e.zip |
Remove the public/ directory
Now that all templates are provided by plugins, there's no need to have
a public/ directory. Themes can be in /themes instead of /public/themes.
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | server.go | 2 | ||||
-rw-r--r-- | template.go | 4 | ||||
-rw-r--r-- | themes/sourcehut/Makefile (renamed from public/themes/sourcehut/Makefile) | 0 | ||||
-rw-r--r-- | themes/sourcehut/assets/style.css (renamed from public/themes/sourcehut/assets/style.css) | 0 | ||||
-rw-r--r-- | themes/sourcehut/caret-left.html (renamed from public/themes/sourcehut/caret-left.html) | 0 | ||||
-rw-r--r-- | themes/sourcehut/compose.html (renamed from public/themes/sourcehut/compose.html) | 0 | ||||
-rw-r--r-- | themes/sourcehut/head.html (renamed from public/themes/sourcehut/head.html) | 0 | ||||
-rw-r--r-- | themes/sourcehut/login.html (renamed from public/themes/sourcehut/login.html) | 0 | ||||
-rw-r--r-- | themes/sourcehut/mailbox.html (renamed from public/themes/sourcehut/mailbox.html) | 0 | ||||
-rw-r--r-- | themes/sourcehut/message.html (renamed from public/themes/sourcehut/message.html) | 0 | ||||
-rw-r--r-- | themes/sourcehut/nav.html (renamed from public/themes/sourcehut/nav.html) | 0 | ||||
-rw-r--r-- | themes/sourcehut/scss/main.scss (renamed from public/themes/sourcehut/scss/main.scss) | 0 | ||||
-rw-r--r-- | themes/test/assets/style.css | 3 | ||||
-rw-r--r-- | themes/test/head.html | 8 |
15 files changed, 18 insertions, 7 deletions
@@ -10,11 +10,11 @@ See `-h` for more information. ## Themes -They should be put in `public/themes/<name>/`. +They should be put in `themes/<name>/`. -Templates in `public/themes/<name>/*.html` override default templates in -`public/*.html`. Assets in `public/themes/<name>/assets/*` are served by the -HTTP server at `/themes/<name>/assets/*`. +Templates in `themes/<name>/*.html` override default templates in plugins. +Assets in `themes/<name>/assets/*` are served by the HTTP server at +`/themes/<name>/assets/*`. ## Plugins @@ -196,7 +196,7 @@ func New(e *echo.Echo, options *Options) error { } }) - e.Static("/themes", "public/themes") + e.Static("/themes", "themes") for _, p := range s.Plugins { p.SetRoutes(e.Group("")) diff --git a/template.go b/template.go index e5078c5..4f33e5e 100644 --- a/template.go +++ b/template.go @@ -10,7 +10,7 @@ import ( "github.com/labstack/echo/v4" ) -const themesDir = "public/themes" +const themesDir = "themes" // GlobalRenderData contains data available in all templates. type GlobalRenderData struct { @@ -76,7 +76,7 @@ func loadTheme(name string, base *template.Template) (*template.Template, error) return nil, err } - theme, err = theme.ParseGlob("public/themes/" + name + "/*.html") + theme, err = theme.ParseGlob(themesDir + "/" + name + "/*.html") if err != nil { return nil, err } diff --git a/public/themes/sourcehut/Makefile b/themes/sourcehut/Makefile index 22b899d..22b899d 100644 --- a/public/themes/sourcehut/Makefile +++ b/themes/sourcehut/Makefile diff --git a/public/themes/sourcehut/assets/style.css b/themes/sourcehut/assets/style.css index ad19257..ad19257 100644 --- a/public/themes/sourcehut/assets/style.css +++ b/themes/sourcehut/assets/style.css diff --git a/public/themes/sourcehut/caret-left.html b/themes/sourcehut/caret-left.html index 3a84034..3a84034 100644 --- a/public/themes/sourcehut/caret-left.html +++ b/themes/sourcehut/caret-left.html diff --git a/public/themes/sourcehut/compose.html b/themes/sourcehut/compose.html index e845423..e845423 100644 --- a/public/themes/sourcehut/compose.html +++ b/themes/sourcehut/compose.html diff --git a/public/themes/sourcehut/head.html b/themes/sourcehut/head.html index dd9522c..dd9522c 100644 --- a/public/themes/sourcehut/head.html +++ b/themes/sourcehut/head.html diff --git a/public/themes/sourcehut/login.html b/themes/sourcehut/login.html index 08074fe..08074fe 100644 --- a/public/themes/sourcehut/login.html +++ b/themes/sourcehut/login.html diff --git a/public/themes/sourcehut/mailbox.html b/themes/sourcehut/mailbox.html index cefe1d8..cefe1d8 100644 --- a/public/themes/sourcehut/mailbox.html +++ b/themes/sourcehut/mailbox.html diff --git a/public/themes/sourcehut/message.html b/themes/sourcehut/message.html index 07b4ad9..07b4ad9 100644 --- a/public/themes/sourcehut/message.html +++ b/themes/sourcehut/message.html diff --git a/public/themes/sourcehut/nav.html b/themes/sourcehut/nav.html index 7b4d19d..7b4d19d 100644 --- a/public/themes/sourcehut/nav.html +++ b/themes/sourcehut/nav.html diff --git a/public/themes/sourcehut/scss/main.scss b/themes/sourcehut/scss/main.scss index c7f15f9..c7f15f9 100644 --- a/public/themes/sourcehut/scss/main.scss +++ b/themes/sourcehut/scss/main.scss diff --git a/themes/test/assets/style.css b/themes/test/assets/style.css new file mode 100644 index 0000000..4d2bab2 --- /dev/null +++ b/themes/test/assets/style.css @@ -0,0 +1,3 @@ +body { + background-color: pink; +} diff --git a/themes/test/head.html b/themes/test/head.html new file mode 100644 index 0000000..35dda42 --- /dev/null +++ b/themes/test/head.html @@ -0,0 +1,8 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <title>koushin</title> + <link rel="stylesheet" href="/assets/style.css"> + </head> + <body> |