Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll regeneration doesn't work inside Vagrant

Tags:

vagrant

jekyll

Running the otherwise working command:

jekyll serve --watch

inside Vagrant is not leading to regeneration of the files unless I restart the jekyll server. I am editing on Windows. Is this a problem with Jekyll running inside Vagrant or is there some configuration that I need to do to make this work? I even tried using foreman with the following Procfile configuration but with the same result

web: jekyll serve --watch
like image 977
Raunaq Avatar asked Nov 06 '13 20:11

Raunaq


4 Answers

It's implemented in the latest pre release (jekyll 2.0.0.alpha.3 by the time of writing).

You should use --force_polling option to get benefit of it.

Try running the jekyll server like this:

jekyll serve --watch --force_polling
like image 115
Erdem Gezer Avatar answered Nov 13 '22 13:11

Erdem Gezer


My guess, based on nothing more than my own experience of this issue is that you are running your jekyll site in the /vagrant folder which vagrant maps/syncs back to the host os.

These mapped or synchronised folders are using some kind of crazy filesystem driver (basically a type of network share) and the file watch features don't work on them.

This SO question shows the same symptom.

(You will see what I mean of you run your jekyll site outside `/vagrant' like in the home folder. Make a change (using nano) and you will see the Regeneration triggering)

like image 27
Pieter Breed Avatar answered Nov 13 '22 13:11

Pieter Breed


What provider are you using? I was able to get it to work on Windows 8 using Virtual Box as a provider and Ubuntu 12.04 as a guest OS. I had to use version 1.2.1 and not the latest version however.

When I use the latest Jekyll version (1.4.2), watch does not work as expected (it doesn't notice the file change and does not rebuild). It does work when I edit them on the guest OS though (it does notice the file change and will rebuild).

Version 1.2.1 works regardless of where the files are edited from (Guest OS or Host OS).

To revert back to version 1.2.1 I ran the following commands:

gem uninstall jekyll
gem install jekyll -v 1.2.1

Note: The jekyll site is running from the vagrant directory

like image 22
Jake Alves Avatar answered Nov 13 '22 14:11

Jake Alves


In vagrant, just add --force_polling, then jekyll will watch almost all files except "_config.yml"

jekyll serve --force_polling

When you change the other files except for "_config.yml", you will see the regeneration.

But if you are changing "_config.yml" it will not trigger the regeneration.

Are you excepting the regeneration when you are changing "_config.yml"?

like image 26
Nick Avatar answered Nov 13 '22 12:11

Nick