Getting Started
Overview
总览
Valaxy (V + Galaxy)旨在成为下一代静态博客框架,提供更好的热更新与用户加载体验、更强大更便捷的自定义开发可能性。
你可以在 为什么选 Valaxy 中了解更多关于项目的设计初衷。
Create a Valaxy Project
创建 Valaxy 项目
Example: yun.valaxy.site
Try it Online
在线试用
你可以通过 StackBlitz 在线试用 Valaxy(默认使用主题 valaxy-theme-yun)。
这是一个极简项目,您仅需一下几个文件,就可以快速搭建好你的博客!
pages
文件夹:存放页面/文章valaxy.config.ts
Valaxy 配置文件package.json
记录依赖
Locally
在本地创建
兼容警告
由于 Vite 要求 Node.js 的版本为 14.18+, 16+,Valaxy 同样需要你将 Node.js 升级至 14.18 版本之后。
如果您想要在本地创建,只需要执行以下命令:
Compatibility Note警告
Vite requires Node.js version 14.18+, 16+. Valaxy also requires you to upgrade Node.js after version 14.18+.
npm init valaxy
由于
npm init
缓存您此前下载的版本,我更推荐您使用pnpm
来创建模版。
安装 pnpm:npm i -g pnpm
Since
npm init
caches your previously downloaded version, I would recommend usingpnpm
to create templates.
Install pnpm:npm i -g pnpm
pnpm create valaxy
跟随命令行提示完成创建!
默认使用主题 valaxy-theme-yun,当然您也可以安装使用任意其他主题。
本文档同样是一个 Valaxy 主题 valaxy-theme-press。
Usage
使用
进入你创建好后的文件夹目录后,执行以下命令。 譬如:
cd valaxy-blog
。
安装依赖:
# install
npm i
# or pnpm i
启动预览:
# start
npm run dev
# or pnpm dev
博客创建完毕,查看本地 http://localhost:4859/
,玩的开心!
See http://localhost:4859/
, have fun!
Config
配置
Modify valaxy.config.ts
to custom your blog.
Documentation is being improved!
修改 valaxy.config.ts
来自定义你的博客吧。
文档正在不断完善中!
Deploy
部署
部署可参见 部署|指南。
Upgrade
升级
cd your-blog
# upgrade valaxy
npm i [email protected]
# upgrade theme
npm i [email protected]
pnpm
你可以使用 pnpm 的交互升级命令。
# interactive upgrade
pnpm up --latest -i
Structure
目录结构
In most cases, you only need to work in the pages
folder.
在大部分情况下,你只需要在 pages
文件夹下进行工作,编写文章。
Main folders
主要的文件夹
pages
: your all pagesposts
: write your posts here, will be counted as posts
styles
: override theme styles,index.scss
/vars.csss
/index.css
will be loaded automaticallycomponents
: custom your vue components (will be loaded automatically)layouts
: custom layouts (use it bylayout: xxx
in md)locales
: custom i18n
pages
: 你的所有页面posts
: 写在pages/posts
文件夹下的内容,将被当作博客文章
styles
: 覆盖主题样式,文件夹下的这些 scss 文件将会被自动加载index.scss
/index.css
css-vars.scss
/css-vars.css
components
: 自定义你的组件(将会被自动注册)layouts
: 自定义布局 (譬如可以通过layout: xxx
来使用layouts/xxx.vue
布局)locales
: 自定义国际化关键词
Other
其他
Theme
主题
If you want to develop a theme and released, you can refer to valaxy-theme-starter.
如果您希望自己开发一个主题并发布,您可以参考 valaxy-theme-starter。
更多内容请参见 如何编写一个 Valaxy 主题.
Community
社区
If you have questions or need help, you can go to the Discord and Discussions to ask for help.
如果你有疑问或者需要帮助,可以到 Discord 和 GitHub Discussions 社区来寻求帮助。
Q.E.D.