ruby - Jekyll 中的缓慢再生

标签 ruby compilation jekyll

我正在使用 jekyll 开发一个博客,到目前为止我对它非常满意。 但是随着我发布更多帖子,再生时间变得荒谬(3-4 分钟)。每次进行更改时都等待那么长时间是不可行的。

规范:

  • ruby 2.2.1
  • 杰基尔 2.5.3
  • Markdown :kramdown
  • 荧光笔:pygments
  • 固定链接:漂亮
  • 使用 2 GB RAM 使用云服务 (Cloud9)
  • 帖子不多(约 10 篇),但我确实使用了很多数据(“_data”文件夹中有 10 MB 的 json 文件,“img”文件夹中有 14 MB 的图像)
  • “_site”文件夹的总大小为 40 MB

这些规范是否正常?

我已经更新到 Jekyll 3.0 以尝试增量再生,但它对我的情况没有帮助。

有什么想法吗?

谢谢!

威廉

最佳答案

在您的网站上运行 jekyll serve --profile 并检查哪些内容需要更多时间来呈现。它应该输出一个看起来像这样的表格。

Filename                                                              | Count |    Bytes |  Time
----------------------------------------------------------------------+-------+----------+------
_layouts/compress.html                                                |    73 | 1649.86K | 1.526
_layouts/default.html                                                 |    72 | 1874.79K | 0.445
_layouts/post.html                                                    |    58 |  980.02K | 0.307
_posts/2015-12-10-how-to-create-and-host-a-website-on-github-pages.md |     1 |    9.36K | 0.294
feed.xml                                                              |     1 |   34.74K | 0.105
_includes/prev-next.html                                              |    58 |   39.17K | 0.053
sitemap.xml                                                           |     1 |   19.90K | 0.035
_pages/archive.md                                                     |     1 |   28.98K | 0.035
_posts/2017-02-15-jekyll-sort-filters.md                              |     1 |   16.09K | 0.019
_includes/ga_data_fetch.html                                          |    58 |   41.77K | 0.018
_includes/disqus-script.html                                          |    58 |   30.89K | 0.018
_pages/tags.html                                                      |     1 |   14.97K | 0.015

这应该能让您清楚地知道问题出在哪里。

现在,在对站点进行更改时,如果您只想呈现更改的文件,请使用 jekyll serve --incrementaljekyll serve -I

增量构建仍然存在 Jekyll 团队正在处理的一些问题。

仅呈现您正在撰写的最新帖子的便捷选项是 jekyll serve --watch --limit_posts 1。这在撰写新帖子时为我节省了大量时间。

关于ruby - Jekyll 中的缓慢再生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33524335/

相关文章:

ruby - 访问 Litmus API 会导致 SSL 错误。有什么办法解决吗?

ruby - 了解 ruby​​ 语法 "class << variable"

c++ - #include 会影响程序大小吗?

performance - Amazon S3 与 Github Pages - 哪个导致最终用户页面加载时间更快?

seo - gh-pages 上的 Jekyll 站点不会出现在谷歌搜索结果中

jekyll - 带有 {% include ... %} 代码块的 GitHub 风格的 Markdown

ruby - 从对象访问变量名

ruby-on-rails - Ruby RestClient.post 用于登录表单

c++ - Windows 10 - 在 cmd 中编译 C++

compilation - 如果从命令行运行 Julia 脚本,是否每次都需要重新编译?