Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
vitepress
Advanced tools
> [VuePress](http://vuepress.vuejs.org/)' little brother, built on top of [vite](https://github.com/vuejs/vite)
VitePress is a static site generator powered by Vite and Vue. It is designed to be simple and performant, making it ideal for documentation sites and blogs.
Creating a Basic Site
This feature allows you to set up a basic VitePress site. The provided code snippet shows how to add scripts to your `package.json` to start the development server, build the site, and serve the built site.
```json
{
"scripts": {
"dev": "vitepress dev",
"build": "vitepress build",
"serve": "vitepress serve"
}
}
```
Markdown Support
VitePress supports Markdown out of the box, allowing you to write your content in a simple and readable format. The code snippet demonstrates a basic Markdown file with headings and paragraphs.
```markdown
# Hello VitePress
This is a paragraph in VitePress.
## Subheading
More content here.
```
Customizing the Theme
You can customize the theme of your VitePress site by extending the default theme. The code snippet shows how to replace the default layout with a custom Vue component.
```js
// .vitepress/theme/index.js
import DefaultTheme from 'vitepress/theme'
import MyLayout from './MyLayout.vue'
export default {
...DefaultTheme,
Layout: MyLayout
}
```
Docusaurus is a static site generator focused on documentation websites. It offers a rich set of features like versioning, search, and theming. Compared to VitePress, Docusaurus is more feature-rich but also more complex to set up.
VuePress is another static site generator powered by Vue. It is similar to VitePress but uses Webpack instead of Vite. VuePress is more mature and has a larger community, but VitePress offers faster build times due to Vite.
Gatsby is a React-based static site generator. It is highly flexible and can be used for a wide range of websites, not just documentation. Gatsby has a large ecosystem of plugins but can be more complex to configure compared to VitePress.
npm install -D vitepress
echo '# Hello VitePress' > index.md
# starts dev server
npx vitepress
# build > .vitepress/dist
npx vitepress build
Note this is early WIP! The default theme is non-existent, but the basic workflow is there.
Configuration can be done via .vitepress/config.js
(see src/config.ts
)
You can develop your custom theme by adding the following files:
.vitepress/theme/Layout.vue
<template>
<h1>Custom Layout!</h1>
<Content/><!-- make sure to include markdown outlet -->
</template>
.vitepress/theme/index.js
import Layout from './Layout.vue'
export default {
Layout,
NotFound: () => 'custom 404', // <- this is a Vue 3 functional component
enhanceApp({ app, router, siteData }) {
// app is the Vue 3 app instance from createApp()
// router is VitePress' custom router (see `lib/app/router.js`)
// siteData is a ref of current site-level metadata.
}
}
Unlike VuePress, the only file with a fixed location in a theme is index.js
- everything else is imported and exported there like in a normal application.
I love VuePress, but being built on top of webpack, the time it takes to spin up the dev server for a simple doc site with a few pages is just becoming unbearable. Even HMR updates can take up to seconds to reflect in the browser!
As a reference, the Composition API RFC repo is just two pages, but it takes 4 seconds to spin up the server, and almost 2 seconds for any edit to reflect in the browser.
Fundamentally, this is because VuePress is a webpack app under the hood. Even with just two pages, it's a full on webpack project (including all the theme source files) being compiled. It gets even worse when the project has many pages - every page must first be fully compiled before the server can even display anything!
Incidentally, vite solves these problems really well: nearly instant server start, on-demand compilation that only compiles the page being served, and fast-as-lightning HMR. Plus, there a a few additional design issues I have noted in VuePress over time, but never had the time to fix due to the amount of refactoring it would require.
Now, with vite
and Vue 3, it is time to rethink what a "Vue-powered static site generator" can really be.
Uses Vue 3.
Uses vite
under the hood:
Lighter page weight.
vue-router
because the need of VitePress is very simple and specific - a simple custom router (under 200 LOC) is used instead.More opinionated and less configurable: VitePress aims to scale back the complexity in the current VuePress and restart from its minimalist roots.
Future oriented: VitePress only targets browsers that support native ES module imports. It encourages the use of native JavaScript without transpilation, and CSS variables for theming.
Maybe! It's currently under a different name so that we don't over commit to the compatibility with the current VuePress ecosystem (mostly themes and plugins). We'll see how close we can get without compromising the design goals listed above. But the overall idea is that VitePress will have a drastically more minimal theming API (preferring JavaScript APIs instead of file layout conventions) and likely no plugins (all customization is done in themes).
MIT
FAQs
Vite & Vue powered static site generator
We found that vitepress demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.