コンテンツにスキップ

Elder.js

Elder.jsは、Svelteを使用して静的サイトを構築するためのSEOに焦点を当てたフレームワークです。

このガイドでは、新しいElder.jsアプリケーションを作成し、Cloudflare Pagesを使用してデプロイします。

新しいプロジェクトの設定

npx degit Elderjs/templateを使用して新しいプロジェクトを作成し、プロジェクト名を指定します:

Terminal window
npx degit Elderjs/template elderjs-app
cd elderjs-app

Elder.jsテンプレートには、静的サイトを構築する方法を示すいくつかのページと例が含まれていますが、プロジェクトを生成するだけで、すでにCloudflare Pagesにデプロイする準備が整っています。

Before you continue

All of the framework guides assume you already have a fundamental understanding of Git. If you are new to Git, refer to this summarized Git handbook on how to set up Git on your local machine.

If you clone with SSH, you must generate SSH keys on each computer you use to push or pull from GitHub.

Refer to the GitHub documentation and Git documentation for more information.

Create a GitHub repository

Create a new GitHub repository by visiting repo.new. After creating a new repository, go to your newly created project directory to prepare and push your local application to GitHub by running the following commands in your terminal:

Terminal window
git init
git remote add origin https://github.com/<your-gh-username>/<repository-name>
git add .
git commit -m "Initial commit"
git branch -M main
git push -u origin main

Cloudflare Pagesでデプロイ

サイトをPagesにデプロイするには:

  1. Cloudflareダッシュボードにログインし、アカウントを選択します。
  2. アカウントホームで、Workers & Pages > Create application > Pages > Connect to Gitを選択します。

まだGitHubアカウントへのアクセスを承認していない場合は、承認を求められます。Cloudflareは、ソースからプロジェクトを監視およびデプロイするためにこれが必要です。特定のリポジトリへのアクセスを制限することもできますが、Cloudflare Pagesに追加のリポジトリを追加したい場合は、GitHubの設定内で手動でこのリストを更新する必要があります。

作成した新しいGitHubリポジトリを選択し、Set up builds and deploymentsセクションで、次の情報を提供します:

Configuration option Value
Production branch main
Build command npm run build
Build directory public

オプションで、Project nameフィールドをカスタマイズできます。デフォルトではGitHubリポジトリの名前が設定されますが、一致する必要はありません。Project nameの値は、あなたの*.pages.devサブドメインとして割り当てられます。

設定の最終化

設定が完了したら、Save and Deployボタンをクリックします。

最初のデプロイパイプラインが進行中であることが表示されます。Pagesはすべての依存関係をインストールし、指定された通りにプロジェクトをビルドします。

Cloudflare Pagesは、新しいコミットがプッシュされるたびに自動的にプロジェクトを再ビルドし、デプロイします。

さらに、プレビュー展開にアクセスでき、プルリクエストのためにビルドおよびデプロイプロセスを繰り返します。これにより、プロダクションにデプロイする前に、実際のURLでプロジェクトの変更をプレビューできます。

Learn more

By completing this guide, you have successfully deployed your Elder.js site to Cloudflare Pages. To get started with other frameworks, refer to the list of Framework guides.