jekyll
安装ruby
1.下载
https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.2-1/rubyinstaller-devkit-2.7.2-1-x64.exe
2.安装
注意:需要勾选安装msys2,后面安装gem和jekyll时会用到。
安装RubyGems
1.下载
https://rubygems.org/rubygems/rubygems-3.2.8.zip
2.解压
unzip rubygems-3.2.8.zip
3.安装
cd rubygems-3.2.8
ruby setup.rb --help
安装jekyll
打开cmd
gem install jekyll
安装jekyll-paginate
打开cmd
gem install jekyll-paginate
验证安装成功
jekyll -v
安装bundler
# 安装bundler,bundler通过gemfile文件来管理gem包
gem install bundler
验证
bundler -v
jekyll相关命令
1.新建jekyll项目
jekyll new myblog
2.启动jekyll项目
cd myblog
# 在Jekyll自带的服务器上预览你的项目,默认的运行地址为http://localhost:4000
# bundle exec 表示在当前项目依赖的上下文环境中执行命令 jekyll serve
# serve 指令将会自动监测变化,生成新的文件
bundle exec jekyll serve
3.访问:
http://127.0.0.1:4000
4.后台运行
jekyll serve --detach
5.浏览器自动刷新
jekyll serve --livereload
6.生成静态文件(默认当前文件夹./_site目录)
jekyll build --source <source> --destination <destination>
7.增量更新
jekyll serve --incremental
问题
问题1:
in 'to_specs': Could not find 'bundler' (1.17.2) required by your Gemfile.lock. (Gem::MissingSpecVersionError)
方案:
gem install bundler:1.17.2
问题2:
Could not find public_suffix-4.0.3 in any of the sources (Bundler::GemNotFound)
方案:
bundle update
问题3:
in 'require': cannot load such file -- webrick (LoadError)
方案:
bundle add webrick