add bundle command
This commit is contained in:
parent
f50ded8589
commit
bccfd218f6
5 changed files with 25 additions and 4 deletions
|
|
@ -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 ."
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ export default defineConfig({
|
|||
clean: false,
|
||||
target: "esnext",
|
||||
treeshake: false,
|
||||
sourcemap: true,
|
||||
platform: "browser",
|
||||
outExtension: () => {
|
||||
return {
|
||||
|
|
|
|||
11
h/tag.go
11
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",
|
||||
|
|
|
|||
11
justfile
11
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
|
||||
|
||||
|
|
|
|||
|
|
@ -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(),
|
||||
|
|
|
|||
Loading…
Reference in a new issue