The main problem of the standart FDT Haxe JS Project is that when you would like to compile for debugging or for production you have to change the flags all the time manually. So I decided to make it automatic with Ant. Now I will only need a double click on the compile mode I prefere and that’s it.
Download and install
After downloading go to:
OSX: (Your User Name)>Library>Application Support>FDT>projectTemplates>Haxe
Copy the content of the Zip file in the Haxe folder.
The new Project Template
Now you can use this Template with the FDT Project Wizard.
File > New > New FDT Project
In the New FDT Project dialog select on the left side Haxe and on the right side you select the new Template “Custom Haxe Project”. Now type in the name of your new project and click on “finish”.
How to configure
Ant settings of this project are stored in the file ant/conf/project.conf
In this file you can tell Ant the location of your main less file and the location of the Haxe Compiler.
In the file ant/conf/compiler.conf you can set the main compiler flags. The -main compiler flag is required. If you need to include one or more additional Haxe Projects you can use an additional -cp flag. If you want to comment a line a out in this conf file you can use #.
Check the config files
compiler.conf – Would you change the name/path of your Main class?
Do you need additional project sources and they’re classes?
project.conf – Would you change the name/path of your main less file?
Where do you installed Haxe on your computer?
The Ant view
Open the ant folder and drag the build.xml into your FDT ant view.
When you unfold the buildfile you will find the 2 compiling modes Release – Debug and Release – Production. A double click on one of these starts the particular ant script.
Where is the magic?
What the Release – Debug script will do:
Clear the release/debug folder.
Copy all files from repository folder to the release/debug folder.
Overwrites the compile.hxml with debugging flags.
Compiles the main less file to release/debug/css/projectname.css
What the Release – Production script will do:
Clear the release/production folder.
Copy all files from repository folder to the release/production folder.
Overwrites the compile.hxml with production flags.
Compiles the main less file to release/production/css/projectname.css and minifies it.
You can use my FDT Custom Haxe Template for your projects or use it as an example to make your own.