我使用我自己创建的名为“north”的 Jekyll 创建了自己的主题。
创建主题后,我得到了一个名为“north-0.1.0.gem”的 gem 文件和一个名为“north.gemspec”的 gemspec 文件。
我将这两个文件都粘贴到新项目“docs”中名为“north”的文件夹中。
北.gemspec
frozen_string_literal: true
Gem::Specification.new do |spec|
spec.name = "north"
spec.version = "0.1.0"
spec.authors = ["kumar.saurabh"]
spec.email = ["kumar.saurabh108@abc.com"]
spec.summary = "test."
spec.homepage = "https://wkrepo.abc.com/saurabh.kumar/uvtheme/tree/2.0"
spec.license = "MIT"
spec.files = `git ls-files -z`.split("\x0").select do |f|
f.match(%r{^(_(includes|layouts|sass)/|(LICENSE|README)((\.(txt|md|markdown)|$)))}i)
end
spec.add_runtime_dependency "jekyll", "~> 3.8"
spec.add_development_dependency "bundler", "~> 1.16"
spec.add_development_dependency "rake", "~> 12.0"
end
_config.yaml
# Build settings
markdown: kramdown
theme: north
plugins:
- jekyll-feed
索引.md
---
# Feel free to add content and custom Front Matter to this file.
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: page-sidebar-layout
---
宝石文件
gem "jekyll", "~> 3.8.5"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "north", "0.1.0", :path => "north/north-0.1.0.gem_FILES"
错误:
在终端:
Invalid theme folder: _sass
Invalid theme folder: _includes
Source: /home/users/kumar.saurabh/www/html/symfony_projects/UVdeskDocs/uvdocs
Destination: /home/users/kumar.saurabh/www/html/symfony_projects/UVdeskDocs/uvdocs/_site
Incremental build: disabled. Enable with --incremental
Generating...
Invalid theme folder: _layouts
Invalid theme folder: assets
Jekyll Feed: Generating feed for posts
Build Warning: Layout 'page-sidebar-layout' requested in _posts/2019-05-09-welcome-to-jekyll.markdown does not exist.
Build Warning: Layout 'page-sidebar-layout' requested in 404.html does not exist.
Build Warning: Layout 'page-sidebar-layout' requested in about.md does not exist.
Build Warning: Layout 'page-sidebar-layout' requested in index.md does not exist.
done in 0.179 seconds.
我还有一个问题:
当我提取 .gem 文件时,我得到了 'data' 文件夹,其中存在 _layouts、_includes 和 _sass 文件夹,但没有 assets 文件夹,尽管我在制作 .gem 文件时添加了 'assets' 文件夹。为什么?
我遵循了以下教程: https ://www.chrisanthropic.com/blog/2016/creating-gem-based-themes-for-jekyll/