Skip to content

Commit 9185525

Browse files
authored
フロントエンド基盤の整備 (#1305)
1 parent babce2e commit 9185525

File tree

23 files changed

+1273
-47
lines changed

23 files changed

+1273
-47
lines changed

.devcontainer/rails/devcontainer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,12 @@
77
"service": "rails-app",
88
"workspaceFolder": "/workspace",
99
"forwardPorts": [],
10-
"remoteUser": "developer"
10+
"remoteUser": "developer",
11+
"customizations": {
12+
"vscode": {
13+
"extensions": [
14+
"esbenp.prettier-vscode"
15+
]
16+
}
17+
}
1118
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22

33
/.claude/settings.local.json
4+
/.pnpm-store
45
/.vscode
56
/docker-compose.override.yml
67
/docs/specs

go/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
/.env
22
/.playwright-mcp
3-
/.pnpm-store
43
/bin
54
/node_modules
65
/server
76
/static/css/*
7+
!/static/css/.gitkeep
88
/static/js/*
9+
!/static/js/.gitkeep
910
/tmp
1011
/web/dist

go/cmd/server/main.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ func main() {
8888
r.Use(proxyMiddleware.Middleware)
8989
}
9090

91+
// 静的ファイルの配信 (Tailwind CLI + esbuild のビルド結果)
92+
fileServer := http.FileServer(http.Dir("./static"))
93+
r.Handle("/static/*", http.StripPrefix("/static", fileServer))
94+
9195
// ヘルスチェックエンドポイント
9296
r.Get("/health", func(w http.ResponseWriter, r *http.Request) {
9397
// DBの接続確認

go/internal/templates/components/head.templ

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,24 @@ package components
22

33
// Head はHTMLヘッダーを生成する
44
templ Head(title, description, assetVersion string) {
5+
<title>{ title } | Mewst</title>
6+
57
<meta charset="utf-8"/>
68
<meta name="viewport" content="width=device-width, initial-scale=1"/>
7-
<title>{ title } | Mewst</title>
89
if description != "" {
910
<meta name="description" content={ description }/>
1011
}
11-
<link rel="stylesheet" href={ "/static/css/app.css?v=" + assetVersion }/>
12-
<script src={ "/static/js/app.js?v=" + assetVersion } defer></script>
12+
<link rel="stylesheet" href={ "/static/css/style.css?v=" + assetVersion }/>
13+
14+
<script type="module" src="https://cdn.jsdelivr.net/gh/starfederation/datastar@1.0.0-RC.6/bundles/datastar.js"></script>
15+
<script>
16+
(() => {
17+
try {
18+
if (matchMedia("(prefers-color-scheme: dark)").matches) {
19+
document.documentElement.classList.add("dark");
20+
}
21+
} catch (_) {}
22+
})();
23+
</script>
24+
<script type="module" src={ "/static/js/main.js?v=" + assetVersion } defer></script>
1325
}

go/internal/templates/components/head_templ.go

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/internal/templates/layouts/simple.templ

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,10 @@ templ Simple(meta SimpleMeta, content templ.Component) {
2020
<head>
2121
@components.Head(meta.Title, meta.Description, meta.AssetVersion)
2222
</head>
23-
<body class="min-h-screen bg-base-200">
24-
<div class="flex min-h-[100svh] flex-col">
25-
<div class="flex-1">
26-
@content
27-
</div>
28-
<div class="sticky bottom-0 z-50 flex p-4">
29-
@components.Flash()
30-
</div>
31-
</div>
23+
24+
<body class="min-h-screen flex items-center justify-center">
25+
@components.Flash()
26+
@content
3227
</body>
3328
</html>
3429
}

go/internal/templates/layouts/simple_templ.go

Lines changed: 4 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/package.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "mewst",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"build:css": "tailwindcss -i web/style.css -o static/css/style.css --minify",
8+
"build:js": "esbuild web/main.js --bundle --outfile=static/js/main.js --minify",
9+
"build": "pnpm build:css && pnpm build:js",
10+
"watch:css": "tailwindcss -i web/style.css -o static/css/style.css --watch",
11+
"watch:js": "esbuild web/main.js --bundle --outfile=static/js/main.js --watch",
12+
"watch": "concurrently \"pnpm:watch:css\" \"pnpm:watch:js\""
13+
},
14+
"keywords": [],
15+
"author": "",
16+
"license": "AGPL-3.0",
17+
"packageManager": "pnpm@10.24.0",
18+
"devDependencies": {
19+
"@tailwindcss/cli": "^4.1.13",
20+
"basecoat-css": "^0.3.2",
21+
"concurrently": "^9.1.2",
22+
"esbuild": "^0.27.0",
23+
"tailwindcss": "^4.1.13"
24+
}
25+
}

0 commit comments

Comments
 (0)