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

skip_if needs to support variable #438

Open
u007 opened this issue Jan 3, 2024 · 3 comments
Open

skip_if needs to support variable #438

u007 opened this issue Jan 3, 2024 · 3 comments

Comments

@u007
Copy link

u007 commented Jan 3, 2024

i wish this could work:

---
skip_if: "<%=pluralName %>: "
---

ive my work around, but would love to see this instead

@Maker-Mark
Copy link

what's your workaround?

@u007
Copy link
Author

u007 commented Mar 28, 2024

i return a boolean variable in prompt, and do a ternary on template like this. instead of writing to the actual file, i wrote it to the .tmp directory to avoid replacing the file

---
to: "<%= generateList ? 'pages/cp1/' : '.tmp/void/' %><%=pluralName%>/[<%=name%>Id]/index.vue"
---

@Maker-Mark
Copy link

@u007 You can just return null and it wont generate. That's a lot better than putting files into .tmp.
https://www.hygen.io/docs/templates/#conditional-rendering

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

No branches or pull requests

2 participants