-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into guides/deploy/aws
- Loading branch information
Showing
33 changed files
with
3,171 additions
and
241 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
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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
--- | ||
title: Aliasy | ||
description: Wprowadzenie do aliasów z Astro. | ||
i18nReady: true | ||
--- | ||
|
||
**Alias** jest sposobem na tworzenie skrótów dla twoich importów. | ||
|
||
Aliasy mogą ułatwić pracę z kodem zawierającym wiele folderów i relatywnych importów. | ||
|
||
```astro title="src/pages/about/company.astro" del="../../components" del="../../assets" | ||
--- | ||
import Button from '../../components/controls/Button.astro'; | ||
import logoUrl from '../../assets/logo.png?url'; | ||
--- | ||
``` | ||
|
||
W tym przykładzie, programista musiałby zrozumieć relację pomiędzy `src/pages/about/company.astro`, `src/components/controls/Button.astro` i `src/assets/logo.png`. Potem, jeśli `company.astro` zmieniłoby swoją lokalizację, importy te także musiałyby zostać zaktualizowane. | ||
|
||
Możesz dodać aliasy dla importów w pliku `tsconfig.json` lub `jsconfig.json`. | ||
|
||
```json title="tsconfig.json" ins={5-6} | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"paths": { | ||
"@components/*": ["src/components/*"], | ||
"@assets/*": ["src/assets/*"] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
:::note | ||
Upewnij się, że `compilerOptions.baseUrl` jest ustawione. Dzięki temu, ścieżki aliasowe będą mogły być rozwiązane. | ||
::: | ||
|
||
Dzięki tej zmianie, możesz teraz importować używając aliasów gdziekolwiek w twoim projekcie: | ||
|
||
```astro title="src/pages/about/company.astro" ins="@components" ins="@assets" | ||
--- | ||
import Button from '@components/controls/Button.astro'; | ||
import logoUrl from '@assets/logo.png?url'; | ||
--- | ||
``` | ||
|
||
Aliasy te są także automatycznie zintegrowane w [VS Code](https://code.visualstudio.com/docs/languages/jsconfig) i innych edytorach tekstu. |
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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: 通过 Cleavr 部署你的 Astro 网站 | ||
description: 如何将你的 Astro 网站通过 Cleavr 部署到你的 VPS 服务器上 | ||
type: deploy | ||
i18nReady: true | ||
--- | ||
|
||
你可以使用 [Cleavr](https://cleavr.io/) 这款服务器和应用部署管理工具,将 Astro 项目部署到自己的虚拟专用服务器(VPS)上。 | ||
|
||
:::tip | ||
请查阅 [Cleavr 文档中的 Astro 指南](https://docs.cleavr.io/guides/astro)! | ||
::: | ||
|
||
## 前期准备 | ||
|
||
在开始操作前,你需要准备: | ||
- 一个 Cleavr 账户 | ||
- 使用 Cleavr 在你的 VPS 提供商上创建一个服务器 | ||
|
||
## 添加你的网站 | ||
|
||
1. 在 Cleavr 中,进入你要将 Astro 项目添加到的服务器中。 | ||
|
||
2. 点击**添加网站**并填写你的应用程序的详细信息,例如域名。 | ||
|
||
3. 对于**应用程序类型**,根据你设置 Astro 应用程序的方式选择 “NodeJS Static” 或 “NodeJS SSR”。 | ||
|
||
4. 对于静态应用程序,请将**构件文件夹**设置为 `dist`。 | ||
|
||
5. 对于 SSR 应用程序: | ||
- 将**入口点**设置为 `entry.mjs`。 | ||
- 将**构件文件夹**设置为 `dist/server`。 | ||
|
||
6. 点击**添加**将网站添加到服务器。 | ||
|
||
## 设置和部署 | ||
|
||
1. 一旦添加了你的新网站,点击**设置和部署**。 | ||
|
||
2. 为你的 Astro 项目选择**版本控制配置文件**、**仓库**和**分支**。 | ||
|
||
3. 对项目进行任何其他必要的配置。 | ||
|
||
4. 点击**部署**选项卡,然后点击**部署**。 | ||
|
||
恭喜,你刚刚部署了你的 Astro 应用程序! |
Oops, something went wrong.