ANT Task for using html-template’s index.template.html
I am constantly changing the default index.template.html in my Flex projects. This is quite nice, as you can even change the index.template.html to index.template.php and it will generate the file correctly. But in most cases I have ANT builds on the servers that do all the building. This is where I found the Flex ANT html-wrapper task falling short.
The Flex ANT html-wrapper task does not let you use custom/modified template files. But don’t worry its actually quite easy to do this in ANT, as its just a bunch of token substitution. Here is one way to accomplish the task (I was having issues with filterchain and replacetokens):
<copy file="${app.base.dir}/html-template/index.template.html"
tofile="${app.webroot.dir}/MyApp.html" />
<replace file="${app.webroot.dir}/MyApp.html" token="$${swf}" value="MyApp"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${width}" value="600"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${height}" value="600"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${bgcolor}" value="#000000"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${application}" value="MyApp"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${version_major}" value="9"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${version_minor}" value="0"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${version_revision}" value="28"/>
tofile="${app.webroot.dir}/MyApp.html" />
<replace file="${app.webroot.dir}/MyApp.html" token="$${swf}" value="MyApp"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${width}" value="600"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${height}" value="600"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${bgcolor}" value="#000000"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${application}" value="MyApp"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${version_major}" value="9"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${version_minor}" value="0"/>
<replace file="${app.webroot.dir}/MyApp.html" token="$${version_revision}" value="28"/>
Pingback: RIA pedia - Rich Internet Applications - Its all about the user experience!
Pingback: Continuous Build: Flex Builder 3 vs Visual Studio 2008 « Tales from a Trading Desk
Pingback: Flex: Custom HTML Wrappers In Ant | Chasing Daydreams