安装vitepres
npm add -D vitepress
输入命令安装
npx vitepress init
开始配置
┌ Welcome to VitePress!
│
◇ Where should VitePress initialize the config?
│ ./docs //文档的路径
│
◇ Site title:
│ My Awesome Project //标题
│
◇ Site description:
│ A VitePress Site //描述
│
◆ Theme: //风格
│ ● Default Theme (Out of the box, good-looking docs) //默认
│ ○ Default Theme + Customization // 默认+自定义
│ ○ Custom Theme //自定义
└
目录结构
docs下存放着文档信息和.vitepress的路由配置
部署linux
.vitepress下的base:"/"
server {
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
listen 8090; #端口
server_name _;
index index.html;
location / {
# content location
root /home/web/docs; #文档的存放在路径
# exact matches -> reverse clean urls -> folders -> not found
try_files $uri $uri.html $uri/ =404;
# non existent pages
error_page 404 /404.html;
# a folder without index.html raises 403 in this setup
error_page 403 /404.html;
# adjust caching headers
# files in the assets folder have hashes filenames
location ~* ^/assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
}
最后是成果