Browse Source

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.
master
Simon Ser 4 years ago
parent
commit
e93346ffa9
No known key found for this signature in database GPG Key ID: FDE7BE0E88F5E48
15 changed files with 18 additions and 7 deletions
  1. +4
    -4
      README.md
  2. +1
    -1
      server.go
  3. +2
    -2
      template.go
  4. +0
    -0
      themes/sourcehut/Makefile
  5. +0
    -0
      themes/sourcehut/assets/style.css
  6. +0
    -0
      themes/sourcehut/caret-left.html
  7. +0
    -0
      themes/sourcehut/compose.html
  8. +0
    -0
      themes/sourcehut/head.html
  9. +0
    -0
      themes/sourcehut/login.html
  10. +0
    -0
      themes/sourcehut/mailbox.html
  11. +0
    -0
      themes/sourcehut/message.html
  12. +0
    -0
      themes/sourcehut/nav.html
  13. +0
    -0
      themes/sourcehut/scss/main.scss
  14. +3
    -0
      themes/test/assets/style.css
  15. +8
    -0
      themes/test/head.html

+ 4
- 4
README.md View File

@@ -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



+ 1
- 1
server.go View File

@@ -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(""))


+ 2
- 2
template.go View File

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


public/themes/sourcehut/Makefile → themes/sourcehut/Makefile View File


public/themes/sourcehut/assets/style.css → themes/sourcehut/assets/style.css View File


public/themes/sourcehut/caret-left.html → themes/sourcehut/caret-left.html View File


public/themes/sourcehut/compose.html → themes/sourcehut/compose.html View File


public/themes/sourcehut/head.html → themes/sourcehut/head.html View File


public/themes/sourcehut/login.html → themes/sourcehut/login.html View File


public/themes/sourcehut/mailbox.html → themes/sourcehut/mailbox.html View File


public/themes/sourcehut/message.html → themes/sourcehut/message.html View File


public/themes/sourcehut/nav.html → themes/sourcehut/nav.html View File


public/themes/sourcehut/scss/main.scss → themes/sourcehut/scss/main.scss View File


+ 3
- 0
themes/test/assets/style.css View File

@@ -0,0 +1,3 @@
body {
background-color: pink;
}

+ 8
- 0
themes/test/head.html View File

@@ -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>

Loading…
Cancel
Save