In Jade, Using – if(…) { } works in html for me without problems. But when I use it in a javascript block, it doesn’t work.
i.e. this:
script(type='text/javascript')
- if(locals.Android) {
settings.device = 'android';
- }
outputs this:
<script type="text/javascript">
- if(locals.Android) {
settings.device = 'android';
- }
</script>
and not this (when locals.Android === true):
<script type="text/javascript">
settings.device = 'android';
</script>
Thanks!
You could put the if() outside the
<script>tag – that way, the<script>tag only gets output whenlocals.Android === trueeg.