A Jekyll plugin that incorporates LiveReload
JavaScript Ruby HTML CSS
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
js Use stock LiveReload.js Aug 3, 2016
lib Upgrade code for Ruby 2.3.4. Sep 26, 2017
test Upgrade code for Ruby 2.3.4. Sep 26, 2017
.document Initial commit to hawkins. Jul 22, 2014
.gitignore
.rubocop.yml Upgrade code for Ruby 2.3.4. Sep 26, 2017
.travis.yml Upgrade code for Ruby 2.3.4. Sep 26, 2017
Gemfile Upgrade code for Ruby 2.3.4. Sep 26, 2017
LICENSE.txt Update README with notes of SSL/TLS. Mar 21, 2016
README.md Add thread event util class. Use URL instead of page path for refresh. Sep 26, 2017
Rakefile Upgrade code for Ruby 2.3.4. Sep 26, 2017
TODO.md Add TODO items. May 10, 2016
hawkins.gemspec Upgrade code for Ruby 2.3.4. Sep 26, 2017

README.md

Build Status

Hawkins

Hawkins is a Jekyll 3.1+ plugin that incorporates LiveReload into the Jekyll "serve" process.

How to Use

Add the following into your Gemfile

group :jekyll_plugins do
  gem 'hawkins'
end

Then run jekyll liveserve to serve your files. The liveserve commands takes all the arguments that serve does but with a few extras that allow you to specify the port that LiveReload runs on or how long LiveReload will wait. See the --help for more information.

How It Works

Hawkins uses a WEBrick servlet that automatically inserts a script tag into a page's head section. The script tag points to a LiveReload server running on the same host (by default on port 35729). That server serves livereload.js over HTTP and also acts as a WebSockets server that speaks the LiveReload protocol.

If you don't have a browser that implements WebSockets, you can use the --swf option that will have Hawkins load a Flash file that implements WebSockets.

Using --ignore

LiveReload errs on the side of reloading when it comes to the message it gets. If, for example, a page is ignored but a CSS file linked in the page isn't, the page will still be reloaded if the CSS file is contained in the message sent to LiveReload. Additionally, the path matching is very loose so that a message to reload "/" will always lead the page to reload since every page starts with "/".

A Note on SSL/TLS

If you tell Jekyll to serve your files over SSL/TLS (by specifying the --ssl-cert and --ssl-key options), then LiveReload will attempt to use SSL/TLS as well. If you are using a certificate that a browser would not normally accept (e.g. self-signed or issued by an unknown certificate authority), you will need to create an exception for the server and port that Jekyll is serving content over and also for the server and port that LiveReload is running on. Generally speaking, these exceptions will be "127.0.0.1:4000" and "127.0.0.1:35729".

A Note on Compatibility

Hawkins does not currently work on JRuby. I'm working on figuring out why, but be forewarned.

Troubleshooting

You can add "?LR-verbose=true" onto the URL and LiveReload will log some messages to Firefox's Web Developer Console (or the Chrome equivalent).

Thanks

Lots of thanks to guard-livereload and rack-livereload which provided a lot of the code and ideas that Hawkins uses. And of course thanks to the Jekyll team and LiveReload team for providing outstanding software.

Copyright

Copyright (c) 2014 Alex Wood. See LICENSE.txt for further details.