内容创建
创建新文章
hexo new post “文章标题”
或使用别名
hexo n “文章标题”
创建新页面
hexo new page “关于”
创建草稿
hexo new draft “草稿标题”
发布草稿
hexo publish draft “草稿标题”
本地开发
启动本地服务器(支持热更新)
npm run server
或
hexo server
或简写
hexo s
指定端口
hexo s -p 5000
查看草稿
hexo s –draft
生成与清理
清理缓存和生成的文件
npm run clean
或
hexo clean
生成静态文件
npm run build
或
hexo generate
或简写
hexo g
部署
部署到 GitHub Pages
npm run deploy
或
hexo deploy
或简写
hexo d
生成并部署(一步完成)
hexo g -d
或
hexo d -g
组合命令
完整部署流程
npm run clean; npm run build; npm run deploy
或使用 Hexo 命令
hexo clean && hexo g -d
主题开发
进入主题目录
cd themes/cactus
安装主题依赖
npm install
代码检查
npm run lint
配置验证
npm run test
查看信息
查看 Hexo 版本
hexo version
列出所有文章
hexo list post
列出所有页面
hexo list page
常用快捷操作
新建文章并立即编辑
hexo n “标题” && code source/_posts/标题.md
清理重建
hexo clean && hexo g
本地预览(访问 http://localhost:4000)
hexo s