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.
This commit is contained in:
parent
d897eeee5c
commit
e93346ffa9
15 changed files with 18 additions and 7 deletions
|
@ -10,11 +10,11 @@ See `-h` for more information.
|
||||||
|
|
||||||
## Themes
|
## 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
|
Templates in `themes/<name>/*.html` override default templates in plugins.
|
||||||
`public/*.html`. Assets in `public/themes/<name>/assets/*` are served by the
|
Assets in `themes/<name>/assets/*` are served by the HTTP server at
|
||||||
HTTP server at `/themes/<name>/assets/*`.
|
`/themes/<name>/assets/*`.
|
||||||
|
|
||||||
## Plugins
|
## 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 {
|
for _, p := range s.Plugins {
|
||||||
p.SetRoutes(e.Group(""))
|
p.SetRoutes(e.Group(""))
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"github.com/labstack/echo/v4"
|
"github.com/labstack/echo/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
const themesDir = "public/themes"
|
const themesDir = "themes"
|
||||||
|
|
||||||
// GlobalRenderData contains data available in all templates.
|
// GlobalRenderData contains data available in all templates.
|
||||||
type GlobalRenderData struct {
|
type GlobalRenderData struct {
|
||||||
|
@ -76,7 +76,7 @@ func loadTheme(name string, base *template.Template) (*template.Template, error)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
theme, err = theme.ParseGlob("public/themes/" + name + "/*.html")
|
theme, err = theme.ParseGlob(themesDir + "/" + name + "/*.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Before Width: | Height: | Size: 241 B After Width: | Height: | Size: 241 B |
3
themes/test/assets/style.css
Normal file
3
themes/test/assets/style.css
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
body {
|
||||||
|
background-color: pink;
|
||||||
|
}
|
8
themes/test/head.html
Normal file
8
themes/test/head.html
Normal 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…
Reference in a new issue