0

I am trying to use jekyll locally to build my website. It is all set up, and I can build and serve and see results at localhost:4000. There are no errors.

The problem is that when I run "Jekyll serve" I can't save files. The save option is greyed out and "ctrl + s" wont work.

I can open and edit the files, can do "Save As" and do other things - basically anything except saving.

I can save files when I am not serving them.

From what I understand, Jekyll is intended to be used to allow saving while serving so we can see our changes as we go. The auto-regenerate function (now a default with serve) supports that use.

I suspect the problem relates to some sort of permissions-type rule stopping me from editing files that are in use.

But because I am self-taught newbie and am not a developer/programmer, I don't know if it is something to do with how I have set up jekyll, notepad++, permissions or something else entirely.

Here is my environment:

  • Windows 8.1 64-bit
  • Ruby v2.1.5p
  • Jekyll v2.5.1
  • wdm v0.1.0
  • RubyDevKit
  • Notepad++ (in admin mode)

Here is what I have tried:

  1. Scaled back the listen gem from v2.10.0 to v2.7.11 (the earlier was listed as safe/tested on a jekyll on windows website)

  2. Scaled back Jekyll from v2.5.3 to v2.5.1 (the earlier was listed as safe/tested on a jekyll on windows website)

  3. Opened Notepad++ in admin mode instead of normal mode.

  4. Tried executing jekyll serve --watch (in case watch enabled saving)

I have not tried re-installing ruby v2.1.3 (listed as safe/tested on a Jekyll on windows website) because Jekyll is otherwise working I don't want to try a re-install except as a last resort - as a newbie I found it a pain to install it on Windows in the first place.

Can anyone help me with this (probably simple) issue?

I thank you for any assistance in advance.

TBB
  • 1,207
  • 1
  • 14
  • 25

2 Answers2

3

Okay. So I feel really stupid.

But instead of pretending this never happened, I had better post this answer in case anyone else has a blonde 'moment' (read: an entire day) like I did:

Firstly, you can't edit the _config.yml files while serving. You can edit the other files - html, markdown, etc - but not the config file.

Secondly, in Notepad++ you need to make an actual change to a document before the saving option will appear.

I was using the _config file as my 'test' document for regeneration. While I did open up other files to check when I first thought I had an issue, I THINK I may not have made any changes to them - so the option to save them was never activated. After that, I only looked at the config file after making changes.

So, I THINK I may have been able to save while serving all along.

However, if I am wrong and it wasn't my own stupidity (which I strongly doubt), the steps I took which fixed it were:

  1. Those steps outlined in my question; and

  2. A reinstall of Notepad++ (as kindly recommended by 'nerver nerver' who has since removed his/her comment after I said that did not work).

SORRY ... and excuse me while I go and crawl away and hide in shame ...

TBB
  • 1,207
  • 1
  • 14
  • 25
1

If the files you were editing at that time was only _config.yml then the expected behavior is that the saved changes are not reflected when the Jekyll server is running/watching.

This is because the server is started after reading the configuration settings in _config.yml, and then changes that happen to that special file after that are not monitored by Jekyll (this is current as of May 2015, in case this gets changed in the future). Currently this is by design. see this SO question as well

What that means is, you have been saving the file when Jekyll is running just fine, the changes just do not get updated. A way to check this is to make some changes, close the file, then open it again (if you want to be extra sure, open in another editor) and see if reflected changes show up.

Changes made to other files in Jekyll when the server is running will be reflected. For example, if I edit a typo in a blog post, edit CSS files or change some formatting, and save in any text editor, Jekyll will regenerate the file from scratch and you should be able to see the changes by refreshing the localhost:4000 page (or whereever your server is running at).

I'm not sure about running Jekyll on Windows, but on a Linux terminal, Jekyll actually notified the number of files that have changed (with a timestamp) and that it regenerated X number of files. Something like

<timestamp> 3 files have changed. Regenerated 3 files in 0.0536 sec..

Lastly, this is probably not your issue, but I thought I might add this here for future reference, do not edit the files inside the _site folder, as they are always deleted and regenerated whenever the server is started again. Editing those files by hand might save and display changes, but the changes will be lost (because they are, statically generated every time by Jekyll)

TL;DR You most probably have been saving your files! The changes in _config.yml are just not reflected once the server is running, and has to be restarted for the new configuration parameters to take effect.

Community
  • 1
  • 1
matrixanomaly
  • 6,627
  • 2
  • 35
  • 58
  • 1
    You are entirely right, @matrixanomaly. This is the essence of why I posted my answer (above or below now that I have +1'd your answer) - as I think you saw toward the end. You explanation of 'why' though is helpful. Thank you. – TBB May 13 '15 at 03:50