Reputation: 43531
My view has:
{% if (process.env.NODE_ENV == 'development') %}
<!-- Livereload script rendered -->
<script type="text/javascript", src="http://" + req.host + ":35729/livereload.js"></script>
{% endif %}
So I'd expect the req.host
to be replaced with localhost
or something. But what renders is:
<script type="text/javascript", src="http://" + req.host + ":35729/livereload.js"></script>
My express config has: app.set('view engine', 'html');
Upvotes: 0
Views: 151
Reputation: 7156
You need to enclose your variable in the variable controls. {{ req.host }}
{% if (process.env.NODE_ENV == 'development') %}
<!-- Livereload script rendered -->
<script type="text/javascript", src="http://{{ req.host }}:35729/livereload.js"></script>
{% endif %}
Upvotes: 1