50

Working with Jekyll for the first time, and it looks like the auto reload functionality (running jekyll --auto --server) is only triggered by updates to markdown files.

Is this the normal behavior? And is there any way to get changes to other types of files like css (I'm using scss) or html files in _layouts to trigger an auto-reload as well?

Zombo
  • 1
  • 62
  • 391
  • 407
danny
  • 10,103
  • 10
  • 50
  • 57

5 Answers5

94

As of version 3.7 run jekyll serve --livereload.

Harry Moreno
  • 10,231
  • 7
  • 64
  • 116
12

As mentioned here, you need to downgrade the directory_watcher gem, which was recently updated with a breaking change.

sudo gem uninstall directory_watcher && sudo gem install directory_watcher -v 1.4.1

(Or alternatively use the latest master branch of jekyll, which is fixed to depend on the older version of directory watcher).

Community
  • 1
  • 1
liliakai
  • 602
  • 7
  • 7
0

I have not found this to be the case, but perhaps you can update your version

git clone --depth 1 git://github.com/mojombo/jekyll.git
cd jekyll
gem build jekyll.gemspec
gem install jekyll
Zombo
  • 1
  • 62
  • 391
  • 407
0

The problem with jekyll watch option is that only rebuild the _site directory,

I recommend you gulp sass

With it you can not only build the _site folder, but have a full browser reload automatically, whenever you hit ctrl+s in any file, the browser will reload.

kmil0v
  • 222
  • 2
  • 4
0

If you're running it frequently, the Repla macOS app makes it easy to startup Jekyll so it automatically refreshes. After Repla is installed, you run it from the Jekyll blog's root directory and pass it the jekyll serve command. For example:

repla server "bundle exec jekyll serve --watch --drafts" -r "...done"

Repla will be configured to refresh each time ...done is printed in the console, which Jekyll prints when it finishes compiling your site.

Repla runs the Jekyll server process in a split below a browser split showing your site:

Jekyll in Repla

After Jekyll is running in Repla, you can also save the configuration to a file with ⌘S, shut it down by closing the window, and run it again just by double-clicking the file. In other words, you can start your Jekyll blog again next time just by opening the file, without involving the terminal at all.

Disclosure: I maintain the Repla app.

robenkleene
  • 572
  • 8
  • 17