-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
31 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
"pagic": { | ||
"use": "@cloudbase/framework-plugin-website", | ||
"inputs": { | ||
"buildCommand": "cd pagic.cn && deno run --unstable --allow-read --allow-write build.ts && deno run --unstable --allow-read --allow-write --allow-net --allow-env --allow-run https://deno.land/x/[email protected].0/mod.ts build", | ||
"buildCommand": "cd pagic.cn && deno run --unstable --allow-read --allow-write build.ts && deno run --unstable --allow-read --allow-write --allow-net --allow-env --allow-run https://deno.land/x/[email protected].1/mod.ts build", | ||
"outputPath": "pagic.cn/dist" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -268,7 +268,7 @@ Additional elements that need to be injected into the HTML `<head>` of the curre | |
For example, add a custom favicon: | ||
|
||
```tsx | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
export default { | ||
head: <link rel="icon" type="image/png" href="/favicon.png" />, | ||
|
@@ -278,7 +278,7 @@ export default { | |
If you need to inject multiple elements, you need to wrap it with `<>` tags: | ||
|
||
```tsx {5,8} | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
export default { | ||
head: ( | ||
|
@@ -299,7 +299,7 @@ export default { | |
Navigation configuration, an example is as follows: | ||
|
||
```tsx | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
export default { | ||
nav: [ | ||
|
@@ -413,7 +413,7 @@ In the above example: | |
Ads displayed at the top of the table of content, an example is as follows: | ||
```tsx | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
export default { | ||
tocAd: ( | ||
|
@@ -463,7 +463,7 @@ export default { | |
The footer of all pages, an example is as follows: | ||
```tsx | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
export default { | ||
footer: ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,7 +191,7 @@ site/ | |
Its content is: | ||
|
||
```tsx | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
const Hello = () => <h1>Hello world</h1>; | ||
|
||
|
@@ -227,7 +227,7 @@ Pagic will not only execute the logic in the `tsx` file when building the page, | |
For example, we can use `React.setState` to implement a counter page: | ||
|
||
```tsx {4,9} | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
const Hello = () => { | ||
const [count, setCount] = React.useState(0); | ||
|
@@ -263,7 +263,7 @@ site/ | |
In the above example, `hello.tsx` will be constructed as `dist/hello.html`, and `_count.tsx` will not be constructed as a page because it starts with `_`. In this way, we can split the `Count` component into the `_count.tsx` file, and then import it in `hello.tsx`: | ||
|
||
```tsx {3,8} | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
import Count from './_count.tsx'; | ||
|
||
|
@@ -282,7 +282,7 @@ export default Hello; | |
Similar to `md` files, `tsx` files also support frontMatter, which is achieved by exporting a `frontMatter` object: | ||
|
||
```tsx {7-9} | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
const Hello = () => <h1>Hello world</h1>; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ jobs: | |
- name: Build gh-pages | ||
run: | | ||
deno --version | ||
deno install --unstable --allow-read --allow-write --allow-net --allow-env --allow-run --name=pagic https://deno.land/x/[email protected].0/mod.ts | ||
deno install --unstable --allow-read --allow-write --allow-net --allow-env --allow-run --name=pagic https://deno.land/x/[email protected].1/mod.ts | ||
pagic build | ||
- name: Deploy gh-pages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ site/ | |
The content of `_layout.tsx` is as follows: | ||
|
||
```tsx | ||
import { React, PagicLayout } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React, PagicLayout } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
const Layout: PagicLayout = ({ title, content }) => ( | ||
<html> | ||
|
@@ -93,7 +93,7 @@ site/ | |
In the above example, `hello.tsx` will be constructed as `dist/hello.html`, and `_sidebar.tsx` will not be constructed as a page because it starts with `_`. In this way, you can split the `Sidebar` component into the `_sidebar.tsx` file, and then import it in `_layout.tsx`: | ||
|
||
```tsx {3,12} | ||
import { React, PagicLayout } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React, PagicLayout } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
import Sidebar from './_sidebar.tsx'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,7 +131,7 @@ The `fn` function is the core logic of the plugin. Since its parameter `pagic` i | |
For example, we can create a plugin that adds a prefix to the `title` of all pages: | ||
|
||
```ts {6-15} | ||
import { PagicPlugin } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { PagicPlugin } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
const prependTitle: PagicPlugin = { | ||
name: 'prepend_title', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ deno install --unstable --allow-read --allow-write --allow-net --allow-env --all | |
If you need to install a specific version of Pagic, you can add the version in the URL: | ||
|
||
```bash | ||
deno install --unstable --allow-read --allow-write --allow-net --allow-env --allow-run --name=pagic https://deno.land/x/[email protected].0/mod.ts | ||
deno install --unstable --allow-read --allow-write --allow-net --allow-env --allow-run --name=pagic https://deno.land/x/[email protected].1/mod.ts | ||
``` | ||
|
||
> Pagic will only require the necessary permissions. If you want to further restrict Pagic's runtime permissions, you can limit it by specifying the read and write directories: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -269,7 +269,7 @@ export default { | |
举个例子,增加一个自定义的 favicon: | ||
|
||
```tsx | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
export default { | ||
head: <link rel="icon" type="image/png" href="/favicon.png" />, | ||
|
@@ -279,7 +279,7 @@ export default { | |
如果需要引入多个标签,则需要用 `<>` 标签包裹: | ||
|
||
```tsx {5,8} | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
export default { | ||
head: ( | ||
|
@@ -300,7 +300,7 @@ export default { | |
导航栏配置,示例如下: | ||
|
||
```tsx | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
export default { | ||
nav: [ | ||
|
@@ -414,7 +414,7 @@ export default { | |
展示在目录上方的广告,示例如下: | ||
```tsx | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
export default { | ||
tocAd: ( | ||
|
@@ -464,7 +464,7 @@ export default { | |
页面底部,会展示在所有页面里,示例如下: | ||
```tsx | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
export default { | ||
footer: ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,7 +191,7 @@ site/ | |
它的内容是: | ||
|
||
```tsx | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
const Hello = () => <h1>Hello world</h1>; | ||
|
||
|
@@ -227,7 +227,7 @@ Pagic 不仅会在渲染页面时执行 `tsx` 文件中的逻辑,而且其中 | |
比如,我们可以使用 `React.setState` 实现一个计数器页面: | ||
|
||
```tsx {4,9} | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
const Hello = () => { | ||
const [count, setCount] = React.useState(0); | ||
|
@@ -263,7 +263,7 @@ site/ | |
在上面的例子中,`hello.tsx` 会被构建为 `dist/hello.html`,而 `_count.tsx` 由于是 `_` 开头,所以不会被构建为页面。这样就可以实现对 `hello.tsx` 的拆分,将 `Count` 组件拆分到 `_count.tsx` 文件中,然后在 `hello.tsx` 中引用即可: | ||
|
||
```tsx {3,8} | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
import Count from './_count.tsx'; | ||
|
||
|
@@ -282,7 +282,7 @@ export default Hello; | |
与 `md` 文件类似,`tsx` 文件也支持头信息,它是通过导出一个 `frontMatter` 对象实现的: | ||
|
||
```tsx {7-9} | ||
import { React } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
const Hello = () => <h1>Hello world</h1>; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ jobs: | |
- name: Build gh-pages | ||
run: | | ||
deno --version | ||
deno install --unstable --allow-read --allow-write --allow-net --allow-env --allow-run --name=pagic https://deno.land/x/[email protected].0/mod.ts | ||
deno install --unstable --allow-read --allow-write --allow-net --allow-env --allow-run --name=pagic https://deno.land/x/[email protected].1/mod.ts | ||
pagic build | ||
- name: Deploy gh-pages | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ site/ | |
其中 `_layout.tsx` 的内容如下: | ||
|
||
```tsx | ||
import { React, PagicLayout } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React, PagicLayout } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
const Layout: PagicLayout = ({ title, content }) => ( | ||
<html> | ||
|
@@ -93,7 +93,7 @@ site/ | |
在上面的例子中,`hello.tsx` 会被构建为 `dist/hello.html`,而 `_sidebar.tsx` 由于是 `_` 开头,所以不会被构建为页面。这样就可以实现对 `_layout.tsx` 的拆分,将 `Sidebar` 组件拆分到 `_sidebar.tsx` 文件中,然后在 `_layout.tsx` 中引用即可: | ||
|
||
```tsx {3,12} | ||
import { React, PagicLayout } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { React, PagicLayout } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
import Sidebar from './_sidebar.tsx'; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -131,7 +131,7 @@ interface PagicPlugin { | |
比如,我们可以创建一个插件,它给所有页面的 `title` 加一个前缀: | ||
|
||
```ts {6-15} | ||
import { PagicPlugin } from 'https://deno.land/x/[email protected].0/mod.ts'; | ||
import { PagicPlugin } from 'https://deno.land/x/[email protected].1/mod.ts'; | ||
|
||
const prependTitle: PagicPlugin = { | ||
name: 'prepend_title', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ deno install --unstable --allow-read --allow-write --allow-net --allow-env --all | |
若需要安装指定版本的 Pagic,则可以在安装的 URL 中加入版本号: | ||
|
||
```bash | ||
deno install --unstable --allow-read --allow-write --allow-net --allow-env --allow-run --name=pagic https://deno.land/x/[email protected].0/mod.ts | ||
deno install --unstable --allow-read --allow-write --allow-net --allow-env --allow-run --name=pagic https://deno.land/x/[email protected].1/mod.ts | ||
``` | ||
|
||
> Pagic 只会要求必须用到的权限,如果你希望更进一步限制 Pagic 运行时的权限,可以通过指定读写目录的方式加以限制: | ||
|