【问题标题】:jekyll serve -w is not workingjekyll serve -w 不工作
【发布时间】:2016-03-07 08:44:01
【问题描述】:

我刚刚下载了 Jekyll 来测试 sass 编译中的“jekyll serve --watch”功能,但它对我不起作用。 “jekyll serve” 不看任何东西来轮询 sass 的变化。有人遇到同样的问题吗?

我安装了 jekyll 3.0.1、Python 2.7.5、Node 0.10.32、Sass 3.4.19、Compass 0.12.2。

$ gem install jekyll
$ jekyll new my-awesome-site
$ cd my-awesome-site
/my-awesome-site $ jekyll serve

我的“_config.yml”设置:

# General settings
highlighter: pygments
markdown: kramdown
kramdown:
  input: GFM
sass:
  sass_dir: _sass
  style: :compressed

注意:我尝试了“jekyll serve”、“jekyll serve -w”和“jekyll serve --watch”,但都不起作用。

【问题讨论】:

  • jekyll serve --trace 的输出是什么?
  • 配置文件:/Users/Sites/styleguide/_config.yml 来源:/Users/Sites/styleguide 目的地:/Users/Sites/styleguide/_site 增量构建:禁用。启用 --incremental Generate... 在 2.485 秒内完成。自动重新生成:启用 '/Users/Sites/styleguide' 配置文件:/Users/Sites/styleguide/_config.yml 服务器地址:127.0.0.1:4000 服务器正在运行...按 ctrl-c 停止。
  • 我在您的版本列表中看到了指南针。您是否使用了基于指南针的框架?你有 github 仓库吗?
  • 这里是回购:github.com/joannaho/jekyll-test.
  • 那么,在_sass/ 中保存文件时,控制台中没有像Regenerating: 1 file(s) changed at 2015-12-03 18:09:50 ...done in 0.347705382 seconds. 这样的变化?在这里它会重新生成两次(为此 github.com/jekyll/jekyll/issues/4213 在 jekyll 上打开了一个错误)。请参阅下面的回复。

标签: python jekyll


【解决方案1】:

我已经探索了您的代码。无法复现,不过好像有bug in Jekyll scss regeneration

我的建议是切换到 Jekyll 的稳定版本。

1 - 在您的 jekyll 站点的根目录下创建一个 Gemfile,其中包含:

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

这将有助于设置一个已知稳定的 Github 页面环境。

2 - 安装捆绑器

gem install bundle

3 - 安装稳定的 gems

bundle install

4 - 运行你的 Jekull

bundle exec jekyll serve

让我知道它是否有效。

【讨论】:

  • 你会在本地安装 Sass 吗?如果这样做,请尝试运行 sass watch 和bundle exec jekyll serve safe --watch(按照大卫的回答)...应该可以工作,因为 sass 将正确编译 css,并且 bundle 将执行 jekyll 以在安全模式下构建您的网站(如 GitHub 页面那样) .
猜你喜欢
  • 1970-01-01
  • 2023-04-02
  • 1970-01-01
  • 1970-01-01
  • 2016-06-03
  • 2016-08-31
  • 2012-01-28
  • 2019-08-01
  • 2019-07-03
相关资源
最近更新 更多