feat: serving static files
for example htmx library in the future tailwindcss out.css file as well
This commit is contained in:
parent
a9fce1bcbf
commit
bb418101dd
|
@ -16,8 +16,17 @@ import (
|
||||||
//go:embed templates
|
//go:embed templates
|
||||||
var templatesFS embed.FS
|
var templatesFS embed.FS
|
||||||
|
|
||||||
|
//go:embed static
|
||||||
|
var staticFilesFS embed.FS
|
||||||
|
|
||||||
func AddPageRoutes(app *pocketbase.PocketBase) {
|
func AddPageRoutes(app *pocketbase.PocketBase) {
|
||||||
app.OnBeforeServe().Add(getIndexPageRoute(app))
|
app.OnBeforeServe().Add(getIndexPageRoute(app))
|
||||||
|
|
||||||
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
|
e.Router.StaticFS("/static", staticFilesFS)
|
||||||
|
// this path works : http://127.0.0.1:8090/static/static/public/htmx.min.js
|
||||||
|
return nil
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// render and return index page
|
// render and return index page
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13,6 +13,10 @@
|
||||||
defer
|
defer
|
||||||
src="https://cdn.jsdelivr.net/gh/pocketbase/js-sdk@master/dist/pocketbase.umd.js"
|
src="https://cdn.jsdelivr.net/gh/pocketbase/js-sdk@master/dist/pocketbase.umd.js"
|
||||||
></script>
|
></script>
|
||||||
|
<script
|
||||||
|
defer
|
||||||
|
src="/static/static/public/htmx.min.js"
|
||||||
|
></script>
|
||||||
<script defer type="text/javascript">
|
<script defer type="text/javascript">
|
||||||
async function callOauth(providerName) {
|
async function callOauth(providerName) {
|
||||||
const pb = new PocketBase("http://127.0.0.1:8090");
|
const pb = new PocketBase("http://127.0.0.1:8090");
|
||||||
|
|
Loading…
Reference in New Issue