According to docs conditional truthy
could also be used include/exclude files or directories . how can I do it in practice ? if I add all the files and directories to the template, how can I exclude them from the project based on the condition ?
* According to this issue, it is not possible but according to the docs (IIUC) it should work. This is pretty confusing
Asked
Active
Viewed 301 times
1

igx
- 4,101
- 11
- 43
- 88
1 Answers
1
If you don't want to include some files, you should set its name to be something like $if(some_condition.truthy)$your_file_name.scala$endif$
When some_condition
is false, this file won't be created.
There are some examples in http4s.g8. In directory src/main/g8/
, there is a file called $if(graal_native_image.truthy)$native-image-readme.md$endif$
. If the variable graal_native_image
is set to true, a file named native-image-readme.md
will be created. Otherwise, this file won't be created.
This method is also worked for directories, as long as you use the same pattern for the directory name.

Genghis Yang
- 11
- 3