我想用thoughtbot的波旁威士忌制作我的octopress博客模板;整洁。我找不到任何从头开始在octopress(或它的词根jekyll)中涵盖主题的文档。所以,我决定自定义octopress默认主题。
我已经添加了相关的宝石到Gemfile
,如:
gem 'compass', '~> 1.0.0.rc.1' # to make compass work with sass 3.3
gem 'sass', '~> 3.3' # unnecessary but better to be placed hier
gem 'bourbon'
gem 'refills'
gem 'neat'
gem 'bitters'
然后,我将默认主题复制到.themes
路径下,如:
ls .themes/classic .themes/bourtlen # so, new theme name is bourtlen :)
我已经使bourtlen
下的sass
文件夹为空。然后在sass
中,我运行:
bourbon install
所有波旁资产现在都在sass
下。然后,我在sass
下添加了screen.scss
:
@import 'compass';
@import 'bourbon/bourbon';
@import 'base/base';
@import 'neat/neat';
@import 'custom/custom'; # for customization, it's also created in sass folder as _custom.scss
毕竟,我已经安装了我的新主题,但是当我点击命令生成网站时,我得到了这些警告&错误:
❯ bin/rake generate --trace
** Invoke generate (first_time)
** Execute generate
## Generating Site with Jekyll
/home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches/browser_support.rb:1:in `require': cannot load such file -- sass/script/node (LoadError)
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches/browser_support.rb:1:in `<top (required)>'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:2:in `require'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:2:in `block in <top (required)>'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `each'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions/monkey_patches.rb:1:in `<top (required)>'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions.rb:9:in `require'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass/sass_extensions.rb:9:in `<top (required)>'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass.rb:5:in `require'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass.rb:5:in `block in <top (required)>'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass.rb:4:in `each'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/lib/compass.rb:4:in `<top (required)>'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/bin/compass:20:in `require'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/bin/compass:20:in `block in <top (required)>'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/bin/compass:8:in `fallback_load_path'
from /home/ekrem/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/compass-0.12.2/bin/compass:19:in `<top (required)>'
from /home/ekrem/.rbenv/versions/2.1.1/bin/compass:23:in `load'
from /home/ekrem/.rbenv/versions/2.1.1/bin/compass:23:in `<main>'
Notice: for 10x faster LSI support, please install http://rb-gsl.rubyforge.org/
Configuration file: /home/ekrem/ws-rails/blog-new/_config.yml
Source: source
Destination: public
Generating...
Build Warning: Layout 'nil' requested in blog/categories/ruby/atom.xml does not exist.
Build Warning: Layout 'nil' requested in blog/categories/rails/atom.xml does not exist.
Build Warning: Layout 'nil' requested in blog/categories/ember/atom.xml does not exist.
Build Warning: Layout 'nil' requested in atom.xml does not exist.
Build Warning: Layout 'nil' requested in robots.txt does not exist.
Build Warning: Layout 'nil' requested in blog/categories/ruby/atom.xml does not exist.
Build Warning: Layout 'nil' requested in blog/categories/rails/atom.xml does not exist.
Build Warning: Layout 'nil' requested in blog/categories/ember/atom.xml does not exist.
done.
站点毕竟在本地运行,但没有效果,因为(可能)这些错误&警告。
我现在正试图做同样的事情(使用波旁威士忌和整洁设置我的自定义Octopress主题),我刚刚设法解决了你遇到的同样问题。
'nil'错误:
由于版本2.2 Jekyll有一个布局验证的问题,所以你必须手动将nil
更改为null
在2个文件:
- 源/atom.xml
- 源/_includes/定制/category_feed.xml
这将整理Jekyll,它将停止打嗝:)
指南针错误:
我有一个相当多的噩梦当我试图升级指南针,以便波旁可以安装。似乎Compass被锁定在旧版本的SASS上,而SASS被锁定在旧版本的listen上,无法更新…
我最终不得不删除我安装的所有Compass版本,然后安装1.0.1版本。
在我的情况下,另一个问题是我有全局安装的gems,而不是每个项目,所以我不得不添加一个.bundle/config
文件来告诉Bundler
在哪里克隆的gems为Octopress的repo。
Bundler配置文件的内容:
---
BUNDLE_PATH: vendor/bundle
BUNDLE_DISABLE_SHARED_GEMS: '1'
在执行这些更改之后,Octopress应该很高兴与Bourbon一起工作。
对于'nil'警告:
在_layouts文件夹中创建一个空的"nil.html"文件
(Jekyll开始验证布局…)