Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: JB/file_exists #244

Closed
groundh0g opened this issue Feb 28, 2015 · 1 comment
Closed

Feature: JB/file_exists #244

groundh0g opened this issue Feb 28, 2015 · 1 comment
Assignees
Labels
Milestone

Comments

@groundh0g
Copy link
Collaborator

In my tinkerings, I've found it useful to know if a file exists. For example, if there's an "avatar_400x400.png" use it, otherwise use "avatar_200x200.png".

Example usage:

{% 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 %}

Comments? Thoughts?

@groundh0g groundh0g self-assigned this Feb 28, 2015
@groundh0g groundh0g added this to the v 0.4.0 milestone Mar 15, 2015
@groundh0g
Copy link
Collaborator Author

Merged. Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant