jekyll使用

jekyll 命令使用。

Windows安装

安装

下载:

双击安装。

输入ruby -v确认。

1
2
3
4
5
6
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
gem install jekyll
gem install jekyll-paginate
gem install bundler
jekyll -v

在 jekyll 目录构建网站:

1
2
3
4
bundle exec jekyll b

## 实时监控文件的变化,实时生成
bundle exec jekyll b --watch

服务运行:

1
bundle exec jekyll serve -H 0.0.0.0 -P 8080

问题及解决

1
2
3
find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)
解决:
bundler版本不一致,将Gemfile.lock中的BUNDLED WITH修改为新安装的版本。
1
2
3
提示:Could not locate Gemfile
初始化:bundle init
注:效果不好。

已有Gemfile文件,但里面的版本较旧,移到其它电脑,重新安装,但版本较新。Gemfile不适应。执行jekyll new my-awesome-site生成一个简单网站示例,从中拿到Gemfile,替换之。

安装指定版本的bundle:

1
gem install bundler -v 1.16.1

Ubuntu安装

1
2
3
4
5
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
gem install jekyll
gem install jekyll-paginate
gem install bundler
jekyll -v
  • 本文作者:李迟
  • 版权声明:原创文章,版权归署名作者,转载建议注明出处(当然不注明亦可)。
  • 本文链接:/pkc/jekyll-usage.html