The Encyclopedia for Creators
クリエイターのための百科事典
このリポジトリを新規にクローンして、開発環境構築から再開お願いします。
旧の Notion 連携バージョンは https://github.com/kiteretz/hyacker-archive に移動しました。
pnpm create astro@latest -- --template basics🧑🚀 Seasoned astronaut? Delete this file. Have fun!
Inside of your Astro project, you'll see the following folders and files:
/
├── public/
│ └── favicon.svg
├── src/
│ ├── layouts/
│ │ └── Layout.astro
│ └── pages/
│ └── index.astro
└── package.json
To learn more about the folder structure of an Astro project, refer to our guide on project structure.
All commands are run from the root of the project, from a terminal:
| Command | Action |
|---|---|
pnpm install |
Installs dependencies |
pnpm dev |
Starts local dev server at localhost:4321 |
pnpm build |
Build your production site to ./dist/ |
pnpm preview |
Preview your build locally, before deploying |
pnpm astro ... |
Run CLI commands like astro add, astro check |
pnpm astro -- --help |
Get help using the Astro CLI |
Feel free to check our documentation or jump into our Discord server.
Astro コードフェンス・TypeScript ファイルともに以下の順序でグループ分けする。 グループ間は空行で区切る。
- Astro 組み込み(
astro、astro:contentなど) - サードパーティライブラリ
@layouts/*@components/*@libs/*@utils/*import type(最後)
src/配下サブディレクトリへの import は必ずエイリアスを使う(相対パス禁止)src/直下のファイル(constant.tsなど)は@/を使う- 同一ディレクトリ内の import は相対パス(
./Nav.astro)でよい
| エイリアス | 対象 |
|---|---|
@components/* |
src/components/* |
@layouts/* |
src/layouts/* |
@libs/* |
src/libs/* |
@utils/* |
src/utils/* |
@scripts/* |
src/scripts/* |
@/* |
src/*(直下ファイル用) |
- 静的・SSR →
.astro - インタラクティブ(React Islands) →
.tsx
| 状況 | 方法 |
|---|---|
.astro で単純なクラス結合 |
class:list={[...]} |
.tsx で単純なクラス結合 |
twJoin(tailwind-merge) |
| 外部 props とのマージ(競合解決) | twMerge(@libs/twMerge) |
@libs/twMergeはカスタム数値スケール(text-24など)に対応した拡張版tailwind-mergeを直接インポートしない
