verb-generate-readme
verb-generate-readme copied to clipboard
ifExists seems to not working?
Super weird... as always :D
{%= ifExists([process.cwd() + '/.verb.head.md'], include(process.cwd() + '/.verb.head.md')) %}
Fails by saying that it cannot include .verb.head.md
beacause it's not found.
~~I forgot, where is exactly this helper? ~~
Found it, it's https://github.com/verbose/verb-repo-helpers.
edit: Oooh. Got it, it's because include
is also called, no matter of the if
condition.
/cc @doowb @jonschlinkert
Okay, the fix is working as I thought.
Put the include
inside function.
{%= ifExists([process.cwd() + '/.verb.head.md'], () => include(process.cwd() + '/.verb.head.md')) %}
But the ifExists
should be changed.
val = typeof val === 'function' ? val() : val;
Ooh, and another solution that may appear is
{% if (ifExists([process.cwd() + '/.verb.md'], true)) { %}
{%= include(process.cwd() + '/.verb.md') %}
{% } %}
but it doesn't work either.