diff --git a/assets/js/package.json b/assets/js/package.json index 04bd9bc..a417950 100644 --- a/assets/js/package.json +++ b/assets/js/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "main": "mhtml.js", "scripts": { - "watch": "tsup ./mhtml.ts --watch --config ./tsup.config.ts", + "watch": "tsup ./mhtml.ts --watch --config ./tsup.config.ts --sourcemap inline", "build": "tsup ./mhtml.ts --minify --config ./tsup.config.ts", "tailwind:watch": "npx tailwindcss -i ./input.css -o ./output.css --watch", "pretty": "prettier --write ." diff --git a/assets/js/tsup.config.ts b/assets/js/tsup.config.ts index 208f6fd..610f00e 100644 --- a/assets/js/tsup.config.ts +++ b/assets/js/tsup.config.ts @@ -10,7 +10,6 @@ export default defineConfig({ clean: false, target: "esnext", treeshake: false, - sourcemap: true, platform: "browser", outExtension: () => { return { diff --git a/h/tag.go b/h/tag.go index 87b0fe5..3b36a58 100644 --- a/h/tag.go +++ b/h/tag.go @@ -215,6 +215,17 @@ func Body(children ...Renderable) Renderable { return Tag("body", children...) } +func Link(href string, rel string) Renderable { + return &Node{ + tag: "link", + attributes: map[string]string{ + "href": href, + "rel": rel, + }, + children: make([]Renderable, 0), + } +} + func Script(url string) Renderable { return &Node{ tag: "script", diff --git a/justfile b/justfile index b2a29e3..2ea0de0 100644 --- a/justfile +++ b/justfile @@ -2,6 +2,17 @@ run-app: just run-gen && air & just watch-js & just watch-gen +bundle: + rm -rf dist + rm -rf assets/dist + just run-gen + go build . + cd assets/js && npm run build + just build-css + mkdir -p dist/assets/dist + cp -r assets/dist/* dist/assets/dist + cp mhtml dist/ + run-gen: go run ./tooling/astgen diff --git a/pages/base/root.go b/pages/base/root.go index 6efeb4c..a2e337c 100644 --- a/pages/base/root.go +++ b/pages/base/root.go @@ -10,8 +10,8 @@ func RootPage(children ...h.Renderable) h.Renderable { return h.Html( h.HxExtension("path-deps, response-targets, mutation-error"), h.Head( - h.Script("https://cdn.tailwindcss.com"), - h.Script("/js/dist/mhtml.js"), + h.Link("/public/main.css", "stylesheet"), + h.Script("/public/mhtml.js"), ), h.Body( partials.NavBar(),