Skip to main content

立即开始

我们建议使用 SvelteKit,它允许你使用 几乎可以构建任何内容。这是 Svelte 团队的官方应用框架,由 Vite 提供支持。使用以下代码创建一个新项目:

¥We recommend using SvelteKit, which lets you build almost anything. It’s the official application framework from the Svelte team and powered by Vite. Create a new project with:

npx sv create myapp
cd myapp
npm install
npm run dev

如果你还不了解 Svelte,请不要担心!你现在可以忽略 SvelteKit 带来的所有优秀功能,稍后再深入研究。

¥Don’t worry if you don’t know Svelte yet! You can ignore all the nice features SvelteKit brings on top for now and dive into it later.

SvelteKit 的替代品(Alternatives to SvelteKit)

¥Alternatives to SvelteKit

你还可以通过运行 npm create vite@latest 并选择 svelte 选项将 Svelte 直接与 Vite 一起使用。这样,npm run build 将使用 vite-plugin-sveltedist 目录中生成 HTML、JS 和 CSS 文件。在大多数情况下,你可能还需要 选择路由库

¥You can also use Svelte directly with Vite by running npm create vite@latest and selecting the svelte option. With this, npm run build will generate HTML, JS, and CSS files inside the dist directory using vite-plugin-svelte. In most cases, you will probably need to choose a routing library as well.

Vite 通常以独立模式用于构建 单页应用 (SPA),你也可以用它来构建 使用 SvelteKit 构建

¥[!NOTE] Vite is often used in standalone mode to build single page apps (SPAs), which you can also build with SvelteKit.

还有适用于 RollupWebpack 以及其他一些 的插件,但我们推荐 Vite。

¥There are also plugins for Rollup, Webpack and a few others, but we recommend Vite.

编辑器工具(Editor tooling)

¥Editor tooling

Svelte 团队维护 VS Code 扩展,并且还与其他各种 编辑器 和工具集成。

¥The Svelte team maintains a VS Code extension, and there are integrations with various other editors and tools as well.

你还可以使用 sv check 从命令行检查你的代码。

¥You can also check your code from the command line using sv check.

寻求帮助(Getting help)

¥Getting help

不要羞于在 Discord 聊天室 中寻求帮助!你还可以在 Stack Overflow 上找到答案。

¥Don’t be shy about asking for help in the Discord chatroom! You can also find answers on Stack Overflow.

上一页 下一页