立即开始
我们建议使用 SvelteKit,这是 Svelte 团队由 Vite 提供支持的官方应用框架:
¥We recommend using SvelteKit, the official application framework from the Svelte team powered by Vite:
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-svelte 在 dist
目录中生成 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.
还有适用于 Rollup、Webpack 以及其他一些 的插件,但我们推荐 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.