In the Titanium CoffeeScript Compiler Plugin post from yesterday I introduced the plugin and described how to install it and use it for Titanium Mobile applications. Since then, I’ve had some inquiries concerning whether the plugin can be used for Titanium Desktop.
Titanium Desktop does not support the registering and use of
<plugins> in your project’s
tiapp.xml file. But today I updated the
plugin.py so that it can be run directly by the python interpreter, thus making it available to command-line scripts. Either the working directory needs to be your project folder …
~/myprojectfolder $ python "/Library/Application Support/Titanium/plugins/ti_coffee_plugin/1.0/plugin.py"
… or you can pass your project’s folder as an argument:
~ $ python "/Library/Application Support/Titanium/plugins/ti_coffee_plugin/1.0/plugin.py" ~/myprojectfolder
So if you install the newest version of plugin.py (please see the previous post and video — or the README — for installation instructions), then run the script whenever you’re about to build your Titanium Desktop project, then you’re good to go.
If you are using Titanium Studio, which I highly recommend you do, you can take advantage of its Eclipse capabilities and add a “builder” to your project so that the plugin.py gets executed automatically each time you build. This video shows how to do that:
Note that the use of Builders is just one way in which custom actions can be executed inside Titanium Studio. Take a look at the Titanium Studio documentation section regarding Customizing Studio, which includes a sample script that executes when a file is saved inside Titanium Studio.