How to make jekyll serve --watch rebuild when replacing an included file?

So the question is largely explained in the title. Suppose I have the following directory structure:

./index.html ./_includes/include1 

And what is the contents of index.html:

 <!DOCTYPE html> <html> <head> <title>Test page for inclusions</title> </head> <body> {% include include1 %} </body> </html> 

Is there a way to restore index.html when changing the include1 file?

Edit: For clarification only, index.html restored when index.html changes, I want to know how to get the regenerated page when something depends on the changes, in this case include1 from the _includes/ directory.

And in case this is important:

 $ jekyll --version jekyll 1.0.3 $ ruby --version ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0] 

My _config.yml:

 $ cat _config.yml timezone: Europe/Amsterdam 

That is, for the most part, I just start with defaults , which seems to work as it knows where to find include1 .

+4
source share
1 answer

Using the -watch command should automatically update your site when anything in your directory changes. It even updates the server when creating a new file.

Make sure you are in the project directory and not in your _site directory. Your projetc should look like this:

  • _layouts
  • _includes
  • _site
  • _posts
  • .. All the rest

If for any reason the -watch command does not update the server, you can always run the jekyll build command in the project directory.

Which platform can I use with which version of the ruby?

0
source

Source: https://habr.com/ru/post/1489864/


All Articles