mirror of https://github.com/vuejs/vitepress
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
5.3 KiB
58 lines
5.3 KiB
3 years ago
|
# What is VitePress?
|
||
|
|
||
2 years ago
|
VitePress is a [Static Site Generator](https://en.wikipedia.org/wiki/Static_site_generator) (SSG) designed for building fast, content-centric websites. In a nutshell, VitePress takes your source content written in [Markdown](https://en.wikipedia.org/wiki/Markdown), applies a theme to it, and generates static HTML pages that can be easily deployed anywhere.
|
||
3 years ago
|
|
||
2 years ago
|
<div class="tip custom-block" style="padding-top: 8px">
|
||
|
|
||
|
Just want to try it out? Skip to the [Quickstart](./getting-started).
|
||
|
|
||
|
</div>
|
||
|
|
||
2 years ago
|
## Use Cases
|
||
|
|
||
|
- **Documentation**
|
||
|
|
||
1 year ago
|
VitePress ships with a default theme designed for technical documentation. It powers this page you are reading right now, along with the documentation for [Vite](https://vitejs.dev/), [Rollup](https://rollupjs.org/), [Pinia](https://pinia.vuejs.org/), [VueUse](https://vueuse.org/), [Vitest](https://vitest.dev/), [D3](https://d3js.org/), [UnoCSS](https://unocss.dev/), [Iconify](https://iconify.design/) and [many more](https://www.vuetelescope.com/explore?framework.slug=vitepress).
|
||
2 years ago
|
|
||
|
The [official Vue.js documentation](https://vuejs.org/) is also based on VitePress, but uses a custom theme shared between multiple translations.
|
||
|
|
||
|
- **Blogs, Portfolios, and Marketing Sites**
|
||
|
|
||
2 years ago
|
VitePress supports [fully customized themes](./custom-theme), with the developer experience of a standard Vite + Vue application. Being built on Vite also means you can directly leverage Vite plugins from its rich ecosystem. In addition, VitePress provides flexible APIs to [load data](./data-loading) (local or remote) and [dynamically generate routes](./routing#dynamic-routes). You can use it to build almost anything as long as the data can be determined at build time.
|
||
2 years ago
|
|
||
|
The official [Vue.js blog](https://blog.vuejs.org/) is a simple blog that generates its index page based on local content.
|
||
|
|
||
2 years ago
|
## Developer Experience
|
||
3 years ago
|
|
||
2 years ago
|
VitePress aims to provide a great Developer Experience (DX) when working with Markdown content.
|
||
3 years ago
|
|
||
2 years ago
|
- **[Vite-Powered:](https://vitejs.dev/)** instant server start, with edits always instantly reflected (<100ms) without page reload.
|
||
3 years ago
|
|
||
2 years ago
|
- **[Built-in Markdown Extensions:](./markdown)** Frontmatter, tables, syntax highlighting... you name it. Specifically, VitePress provides many advanced features for working with code blocks, making it ideal for highly technical documentation.
|
||
3 years ago
|
|
||
2 years ago
|
- **[Vue-Enhanced Markdown:](./using-vue)** each Markdown page is also a Vue [Single-File Component](https://vuejs.org/guide/scaling-up/sfc.html), thanks to Vue template's 100% syntax compatibility with HTML. You can embed interactivity in your static content using Vue templating features or imported Vue components.
|
||
3 years ago
|
|
||
2 years ago
|
## Performance
|
||
3 years ago
|
|
||
8 months ago
|
Unlike many traditional SSGs where each navigation results in a full page reload, a website generated by VitePress serves static HTML on the initial visit, but becomes a [Single Page Application](https://en.wikipedia.org/wiki/Single-page_application) (SPA) for subsequent navigation within the site. This model, in our opinion, provides an optimal balance for performance:
|
||
3 years ago
|
|
||
2 years ago
|
- **Fast Initial Load**
|
||
3 years ago
|
|
||
8 months ago
|
The initial visit to any page will be served the static, pre-rendered HTML for fast loading speed and optimal SEO. The page then loads a JavaScript bundle that turns the page into a Vue SPA ("hydration"). Contrary to common assumptions of SPA hydration being slow, this process is actually extremely fast thanks to Vue 3's raw performance and compiler optimizations. On [PageSpeed Insights](https://pagespeed.web.dev/report?url=https%3A%2F%2Fvitepress.dev%2F), typical VitePress sites achieve near-perfect performance scores even on low-end mobile devices with a slow network.
|
||
3 years ago
|
|
||
2 years ago
|
- **Fast Post-load Navigation**
|
||
3 years ago
|
|
||
2 years ago
|
More importantly, the SPA model leads to better user experience **after** the initial load. Subsequent navigation within the site will no longer cause a full page reload. Instead, the incoming page's content will be fetched and dynamically updated. VitePress also automatically pre-fetches page chunks for links that are within viewport. In most cases, post-load navigation will feel instant.
|
||
3 years ago
|
|
||
2 years ago
|
- **Interactivity Without Penalty**
|
||
3 years ago
|
|
||
2 years ago
|
To be able to hydrate the dynamic Vue parts embedded inside static Markdown, each Markdown page is processed as a Vue component and compiled into JavaScript. This may sound inefficient, but the Vue compiler is smart enough to separate the static and dynamic parts, minimizing both the hydration cost and payload size. For the initial page load, the static parts are automatically eliminated from the JavaScript payload and skipped during hydration.
|
||
3 years ago
|
|
||
2 years ago
|
## What About VuePress?
|
||
3 years ago
|
|
||
2 years ago
|
VitePress is the spiritual successor of VuePress. The original VuePress was based on Vue 2 and webpack. With Vue 3 and Vite under the hood, VitePress provides significantly better DX, better production performance, a more polished default theme, and a more flexible customization API.
|
||
3 years ago
|
|
||
2 years ago
|
The API difference between VitePress and VuePress mostly lies in theming and customization. If you are using VuePress 1 with the default theme, it should be relatively straightforward to migrate to VitePress.
|
||
3 years ago
|
|
||
2 years ago
|
There has also been effort invested into VuePress 2, which also supports Vue 3 and Vite with more compatibility with VuePress 1. However, maintaining two SSGs in parallel isn't sustainable, so the Vue team has decided to focus on VitePress as the main recommended SSG in the long run.
|