简体   繁体   English

通过jekyll在github页面中不需要的文件

[英]unrequired files in github pages through jekyll

I'm fairly new to ruby and jekyll and I wanna start using jekyll to meu personal webpage. 我是红宝石和jekyll的新手,我想开始使用jekyll来备忘录个人网页。 Among the files in my repo there is a'Gemfile' and 'Gemfile.lock' files. 在我的仓库中的文件中有一个'Gemfile'和'Gemfile.lock'文件。 The Gemfile is used to manage dependencis and Gemfile.lock is generated through Gemfile用于管理依赖关系,而Gemfile.lock通过以下方式生成

bundle install

Is any of them required to be in the repo, or does gh-pages overrides any definitions contained in those files? 是否需要将它们中的任何一个存储在仓库中,或者gh-pages是否覆盖了这些文件中包含的任何定义?

Other contained folder is '.sass-cache'. 其他包含的文件夹是'.sass-cache'。 From this question I get the impression that it's used for caching issues. 这个问题中,我得到的印象是它用于缓存问题。 Once again, is it required, or gh-pages generates those files itself? 还是需要它,还是gh-pages自己生成这些文件?

You can version your Gemfile . 您可以对Gemfile进行版本Gemfile This can be useful for a reinstall. 这对于重新安装很有用。 gemfile.lock and .sass-cache are not necessary to push to Github. gemfile.lock.sass-cache不需要推送到Github。 They are used locally. 它们在本地使用。

If your Gemfile contains something other than: 如果您的Gemfile包含以下内容以外的内容:

source 'https://rubygems.org'
gem 'github-pages'

That certainly means that you use plugins that are not supported by Github ( see supported plugins list here ). 那当然意味着您使用的是Github不支持的插件请参阅此处的受支持插件列表 )。 You then need to generate your site locally and push the result to your Github. 然后,您需要在本地生成站点并将结果推送到Github。

I've described a workflow here and you can also have a look at Octopress rake file that can help for such a setup (need small hacks to be used on a basic Jekyll install). 我在这里描述了工作流程 ,您也可以查看可以帮助进行此类设置的Octopress rake文件 (需要在基本的Jekyll安装中使用小的hack)。

From my interpretation of the docs , github simply uses their own github-pages gem to pull in dependencies and then runs jekyll serve on your repo. 根据我对文档的解释,github只是使用他们自己的github-pages gem来获取依赖项,然后在您的存储库上运行jekyll serve

One consequence of that is that your gemfile (and thus any gems not part of github-pages) is ignored. 其结果之一是您的gemfile(以及因此不是github-page一部分的任何gem)将被忽略。 For example, I use jekyll-less to generate my CSS but since this is not part of github-pages, making CSS changes is a multi-step process for me: 例如,我使用jekyll-less来生成我的CSS,但是由于这不是github-pages的一部分,因此对我来说,进行CSS更改是一个多步骤的过程:

  1. Update .less files 更新.less文件
  2. Build 建立
  3. Copy compiled CSS out of _site _site复制已编译的CSS
  4. Commit .css changes 提交.css更改
  5. Push

Another consequence is that any run-time or build-time stuff you use is ignored by github, so your .sass-cache directory does not need to be added to the repo. 另一个结果是,您使用的任何运行时或构建时资料都会被github忽略,因此您的.sass-cache目录不需要添加到存储库中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM