You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/pages/framework-guides/deploy-a-preact-site.mdx
+7-8Lines changed: 7 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,16 +8,21 @@ import { Render } from "~/components";
8
8
[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.
9
9
10
10
In this guide, you will create a new Preact application and deploy it using Cloudflare Pages.
11
-
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.
11
+
You will use [`create-preact`](https://github.com/preactjs/create-preact), a lightweight project scaffolding tool, to quickly generate a Preact app.
12
12
13
13
## Setting up a new project
14
14
15
15
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:
16
16
17
17
```sh
18
-
npm init wmr your-project-name
18
+
npm init wmr preact
19
19
cd your-project-name
20
20
```
21
+
:::note
22
+
23
+
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.
24
+
25
+
:::
21
26
22
27
<Renderfile="tutorials-before-you-start" />
23
28
@@ -50,12 +55,6 @@ After completing configuration, select **Save and Deploy**.
50
55
51
56
You will see your first deploy pipeline in progress. Pages installs all dependencies and builds the project as specified.
52
57
53
-
:::note
54
-
55
-
**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.
56
-
57
-
:::
58
-
59
58
After you have deployed your site, you will receive a unique subdomain for your project on `*.pages.dev`.
60
59
61
60
Cloudflare Pages will automatically rebuild your project and deploy it on every new pushed commit.
0 commit comments