openjpeg/_includes/JB/file_exists

27 lines
787 B
Plaintext
Raw Normal View History

2015-06-16 10:54:48 +02:00
{% comment %}<!--
param: file = "/example/file.png"
return: file_exists_result = true
examples:
{% include JB/file_exists file="/404.html" %}
{% if file_exists_result %}Found "/404.html"!{% else %}Did not find "/404.html".{% endif %}
{% assign filename = "/405.html" %}
{% include JB/file_exists file=filename %}
{% if file_exists_result %}Found "{{ filename }}"!{% else %}Did not find "{{ filename }}".{% endif %}
NOTE: the BREAK statement in the FOR loop assumes Liquid >= 2.5.0
-->{% endcomment %}
{% assign file_exists_result = false %}
{% if include.file %}
{% for static_file in site.static_files %}
{% if static_file.path == include.file %}
{% assign file_exists_result = true %}
{% break %}
{% endif %}
{% endfor %}
{% endif %}