Create dependency templates



Let say that I have some dependency files, xml or whatever and I would like to transform it into templates, like the template.html but for different purpose. How can I do that? Should I use macro? Ideally, I would like to control the content of the template from project.xml.


It depends on the target, but for HTML5, iOS and Android, there is a “template” directory (like “html/template/index.html”) where everything in that template path is copied. For example, on Android, I believe you could add a new file (which is processed as a template) by adding “android/template/myfile.xml” to your own template directory


Yes, indeed if I add any custom file with the following expression ::APP_TITLE::, it works. But now, how can I add my own custom expression, e.g: ::myCustom:: ? Where can I set the value of myCustom, can I add it in project.xml?


In project.xml:

<set name="myCustom" value="hello world" />

In your template:

cout << "::SET_myCustom::";

You can also use <haxedef />, in which case the template variable would be DEFINE_myCustom. There aren’t any other prefixes available, but those two should be enough.


Awesome! It works great! Thanks.