{"id":21804882,"url":"https://github.com/pez/shadow-cljs-quickstart-browser","last_synced_at":"2026-05-13T05:40:11.982Z","repository":{"id":234500787,"uuid":"668155926","full_name":"PEZ/shadow-cljs-quickstart-browser","owner":"PEZ","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-19T06:45:50.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T04:25:15.690Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PEZ.png","metadata":{"files":{"readme":"README-ja.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-19T06:45:48.000Z","updated_at":"2023-07-19T06:45:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"4cb8df2f-b806-470d-91c3-ee74529ba45f","html_url":"https://github.com/PEZ/shadow-cljs-quickstart-browser","commit_stats":null,"previous_names":["pez/shadow-cljs-quickstart-browser"],"tags_count":0,"template":false,"template_full_name":"shadow-cljs/quickstart-browser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PEZ%2Fshadow-cljs-quickstart-browser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PEZ%2Fshadow-cljs-quickstart-browser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PEZ%2Fshadow-cljs-quickstart-browser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PEZ%2Fshadow-cljs-quickstart-browser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PEZ","download_url":"https://codeload.github.com/PEZ/shadow-cljs-quickstart-browser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244759813,"owners_count":20505709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-27T11:57:16.685Z","updated_at":"2026-05-13T05:40:11.953Z","avatar_url":"https://github.com/PEZ.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# shadow-cljs - ブラウザ・クイックスタート\n\nこれはブラウザ上で動作するCLJSプロジェクトで利用できる最小限のテンプレートです。\n\n## 必要なソフトウェア\n\n- [node.js (v6.0.0+)](https://nodejs.org/en/download/)\n- [Java JDK (8+)](http://www.oracle.com/technetwork/java/javase/downloads/index.html) または [Open JDK (8+)](http://jdk.java.net/10/)\n\n## ユーザーガイド\n\nこのリポジトリでは、基本的なブラウザ向けのビルド方法を示します。\n\n詳細は完全な[ユーザーガイド](https://shadow-cljs.github.io/docs/UsersGuide.html)をご参照ください。\n\n\n## 例の実行\n\n```bash\ngit clone https://github.com/shadow-cljs/quickstart-browser.git quickstart\ncd quickstart\nnpm install\nnpx shadow-cljs server\n```\n\n以上により `shadow-cljs` サーバープロセスが実行され、以下のすべてのコマンドはこのプロセスに応答します。\nこのプロセスを実行したまま、新しいターミナルを開いて続行してください。\n\n最初の起動は、すべての依存関係をダウンロードして準備作業を行う必要があるため、少し時間がかかります。\nこれが実行されると、すぐに始められます。\n\n```txt\nnpx shadow-cljs watch app\n```\n\nこれにより設定された `:app` ビルドのコンパイルが開始して、ファイルを変更するたびに再コンパイルします。\n\n\"Build completed.\" というメッセージが表示されたら、ビルドを使用する準備が整いました。\n\n```txt\n[:app] Build completed. (23 files, 4 compiled, 0 warnings, 7.41s)\n```\n\nでは [http://localhost:8020](http://localhost:8020)を開きましょう。\n\nこのアプリは、最も便利な開発ツールが設定された基本的なスケルトンに過ぎません。\n\n`shadow-cljs` の設定は `shadow-cljs.edn` でします。次のようなものです。\n\n```clojure\n;; shadow-cljs の設定\n{:source-paths ; .cljs ファイルはここで指定します\n [\"src/dev\"\n  \"src/main\"\n  \"src/test\"] \n\n :dependencies ; 後ほど説明します\n [] \n\n :dev-http ; http://localhost:8020 上で http 開発用サーバーを起動し、`public` をサーブします。\n {8020 \"public\"}\n\n :builds\n {:app ; build identifier\n  {:target :browser\n   :output-dir \"public/js\"\n   :asset-path \"/js\"\n\n   :modules\n   {:main ; becomes public/js/main.js\n    {:init-fn starter.browser/init}}}}}\n```\n\nこの設定では、`:target` を `:browser` に設定した `:app` ビルドを定義します。\nすべての出力は `public/js` に書き込まれます。\nこれはプロジェクトのルートからの相対パスです。つまり、`shadow-cljs.edn` の設定があるディレクトリからの相対パスです。\n\n`:modules` は、出力をどのようにまとめるかを定義します。\n今のところ、1つのファイルだけが必要です。\n`main` モジュールは `public/js/main.js` に書き込まれ、`:entrices` のコードと、それらの依存関係をすべて含みます。\n\n最後の部分は、`http://localhost:8020` を開いたときに読み込まれる実際の `index.html` です。\nこの index ファイルは、生成された `js/main.js` をロードして、`src/main/start/browser.cljs` で定義された `start.browser.init` を呼び出します。\n\n```html\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n\u003chead\u003e\n    \u003cmeta charset=\"UTF-8\"\u003e\n    \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"\u003e\n    \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"\u003e\n    \u003clink rel=\"stylesheet\" href=\"/css/main.css\"\u003e\n    \u003ctitle\u003eBrowser Starter\u003c/title\u003e\n\u003c/head\u003e\n\u003cbody\u003e\n\u003ch1\u003eshadow-cljs - Browser\u003c/h1\u003e\n\u003cdiv id=\"app\"\u003e\u003c/div\u003e\n\u003cnoscript\u003eYou need to enable JavaScript to run this app.\u003c/noscript\u003e\n\u003cscript src=\"/js/main.js\"\u003e\u003c/script\u003e\n\u003c/body\u003e\n\u003c/html\u003e\n```\n\n## ライブリロード\n\nライブリロードの動作を確認するには、`src/main/start/browser.cljs`を編集します。\nブラウザのコンソールにいくつかの出力が表示されます。\n\n## REPL\n\n開発時には、REPLが非常に便利です。\n\nコマンドラインから`npx shadow-cljs cljs-repl app`を使用します。\n\n```\nshadow-cljs - config .../shadow-cljs.edn\nshadow-cljs - connected to server\ncljs.user=\u003e\n```\n\nこれで、ブラウザ上でコードを評価することができるようになりました（ブラウザを開いていることが前提です）。\n試しに `(js/alert \"Hi.\")` を実行してみてください。\nここでたくさんの文字を入力するつもりなら、`rlwrap npx shadow-cljs cljs-repl app`を使用するとよいでしょう。\n\nREPLを終了するには、`CTRL+C`か、`:repl/quit`と入力します。\n\n## リリース\n\n最初に始めた `watch` プロセスは、すべて開発のためのものです。\nREPLや他のすべての開発ツールに必要なコードを注入しますが、\nコードを「プロダクション」（つまり一般に公開すること）に投入する際には、そのようなコードは必要ありません。\n\n`release`アクションは、すべての開発コードを削除し、コードをClosure Compilerに通して、最小化された`main.js`ファイルを生成します。\nこのファイルは `watch` で作成されたファイルを上書きするため、まず watch プロセスを停止する必要があります。\n\n`CTRL+C`で`watch`プロセスを停止し、代わりに`npx shadow-cljs release app`を実行します。\n\n`http://localhost:8020` を開くと、`release` のビルドが動作しているのを見ることができます。\n通常だと、この時点で `public` ディレクトリを プロダクションの Web サーバにコピーします。\n\nデフォルトの設定では、`watch` で作成された `public/js/main.js` を上書きしていることに注意してください。\nリリースビルドに使用する別のパスを設定することもできますが、\n出力を同じファイルに書き込むことで`index.html` を変更する必要がなくなり、すべてをそのままテストすることができます。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpez%2Fshadow-cljs-quickstart-browser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpez%2Fshadow-cljs-quickstart-browser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpez%2Fshadow-cljs-quickstart-browser/lists"}