Skip to content

Instantly share code, notes, and snippets.

@renebakx
Created February 16, 2017 10:10
Show Gist options
  • Save renebakx/c526ab512850c656ab2b51e06e98ca3d to your computer and use it in GitHub Desktop.
Save renebakx/c526ab512850c656ab2b51e06e98ca3d to your computer and use it in GitHub Desktop.
twig trick to hide content without marking it as a comment {# #}
Sometimes you need to implement HTML from a style guide, but commenting out the whole block with {# #} makes it unreadable.
This little 'trick' let's your editor do proper syntax highlighting without showing the HTML in your output
{% if false == true %}
<div class="form-column">
<label for="upload">Your Resumé</label>
<div class="file-upload-field">
<div class="name-display">
<svg class="icon icon-check"><use xlink:href="#icon-check"></use></svg>
<svg class="icon icon-cross"><use xlink:href="#icon-cross"></use></svg>
<p>
Temporary name
</p>
</div>
<label class="fileUpload">
<input name="upload-file-first" type="file" class="upload upload-input" />
<span class="upload-button">Select file</span>
</label>
</div>
</div>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment