liquid - Is there a way to check whether a jekyll site is being served locally? -


i'd add following line head.html solely when running jekyll serve locally:

  <script src="http://127.0.0.1:35729/livereload.js?snipver=1"></script> 

i'm thinking of using simple liquid check if possible.

alternative solution (for example, if you're hosting jekyll site on own server , not on github pages):

you can set value in config file _config.yml this:

environment: prod 

then, can have config file overrides same value, i'll call config_dev.yml:

environment: dev 

when call jekyll build, use value prod real config file.

but when build site on local machine testing, pass both config files in order:

jekyll build --config _config.yml,_config_dev.yml 

the value second config file override value first config file, environment set dev.

and can same described in david's answer:

{% if site.environment == "dev" %}   <script src="http://127.0.0.1:35729/livereload.js?snipver=1"></script> {% endif %} 

you can see example in the source code of blog:


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -