Skip to content

Commit

Permalink
recreated PR16235 - change wmr to create-preact
Browse files Browse the repository at this point in the history
  • Loading branch information
ToriLindsay committed Sep 30, 2024
1 parent 0f38f2f commit 4dc2dda
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/content/docs/pages/framework-guides/deploy-a-preact-site.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ import { Render } from "~/components";
[Preact](https://preactjs.com) is a popular, open-source framework for building modern web applications. Preact can also be used as a lightweight alternative to React because the two share the same API and component model.

In this guide, you will create a new Preact application and deploy it using Cloudflare Pages.
You will use [`wmr`](https://github.com/preactjs/wmr), an all-in-one development tool built by the Preact team, to quickly generate an optimized web application.
You will use [`create-preact`](https://github.com/preactjs/create-preact), a lightweight project scaffolding tool, to quickly generate a Preact app.

## Setting up a new project

Create a new project by running the [`npm init`](https://docs.npmjs.com/cli/v6/commands/npm-init) command in your terminal, giving it a title:

```sh
npm init wmr your-project-name
npm init wmr preact
cd your-project-name
```
:::note

During initialization, select the **Prerender app (SSG)?** option to allow `create-preact` to scaffold your app to produce static HTML pages, along with their assets, for production builds. This option is perfect for Pages.

:::

<Render file="tutorials-before-you-start" />

Expand Down Expand Up @@ -50,12 +55,6 @@ After completing configuration, select **Save and Deploy**.

You will see your first deploy pipeline in progress. Pages installs all dependencies and builds the project as specified.

:::note

**Note:** You will notice that within the `package.json` file, the `"build"` script uses the `--prerender` flag. With this, `wmr` produces static HTML pages – along with their assets – which is perfect for Pages.

:::

After you have deployed your site, you will receive a unique subdomain for your project on `*.pages.dev`.

Cloudflare Pages will automatically rebuild your project and deploy it on every new pushed commit.
Expand Down

0 comments on commit 4dc2dda

Please sign in to comment.