An alternative solution (for example, if you host the Jekyll website on your own server, and not on GitHub pages):
You can set the value in the configuration file _config.ymlas follows:
environment: prod
Then you may have another configuration file that overrides the same value, I will name it config_dev.yml:
environment: dev
When you just call jekyll build, it will use the value prodfrom the real configuration file.
, :
jekyll build --config _config.yml,_config_dev.yml
, environment dev.
, :
{% if site.environment == "dev" %}
<script src="http://127.0.0.1:35729/livereload.js?snipver=1"></script>
{% endif %}
: