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",
|
"version": "1.0.0",
|
||||||
"main": "mhtml.js",
|
"main": "mhtml.js",
|
||||||
"scripts": {
|
"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",
|
"build": "tsup ./mhtml.ts --minify --config ./tsup.config.ts",
|
||||||
"tailwind:watch": "npx tailwindcss -i ./input.css -o ./output.css --watch",
|
"tailwind:watch": "npx tailwindcss -i ./input.css -o ./output.css --watch",
|
||||||
"pretty": "prettier --write ."
|
"pretty": "prettier --write ."
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ export default defineConfig({
|
||||||
clean: false,
|
clean: false,
|
||||||
target: "esnext",
|
target: "esnext",
|
||||||
treeshake: false,
|
treeshake: false,
|
||||||
sourcemap: true,
|
|
||||||
platform: "browser",
|
platform: "browser",
|
||||||
outExtension: () => {
|
outExtension: () => {
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
11
h/tag.go
11
h/tag.go
|
|
@ -215,6 +215,17 @@ func Body(children ...Renderable) Renderable {
|
||||||
return Tag("body", children...)
|
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 {
|
func Script(url string) Renderable {
|
||||||
return &Node{
|
return &Node{
|
||||||
tag: "script",
|
tag: "script",
|
||||||
|
|
|
||||||
11
justfile
11
justfile
|
|
@ -2,6 +2,17 @@
|
||||||
run-app:
|
run-app:
|
||||||
just run-gen && air & just watch-js & just watch-gen
|
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:
|
run-gen:
|
||||||
go run ./tooling/astgen
|
go run ./tooling/astgen
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,8 @@ func RootPage(children ...h.Renderable) h.Renderable {
|
||||||
return h.Html(
|
return h.Html(
|
||||||
h.HxExtension("path-deps, response-targets, mutation-error"),
|
h.HxExtension("path-deps, response-targets, mutation-error"),
|
||||||
h.Head(
|
h.Head(
|
||||||
h.Script("https://cdn.tailwindcss.com"),
|
h.Link("/public/main.css", "stylesheet"),
|
||||||
h.Script("/js/dist/mhtml.js"),
|
h.Script("/public/mhtml.js"),
|
||||||
),
|
),
|
||||||
h.Body(
|
h.Body(
|
||||||
partials.NavBar(),
|
partials.NavBar(),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue