Quick Tip: XML2TSS

Fresk leaves invoking a happy mood.

XML2TSS is a command-line tool written by Titanium Titan David Bankier (@davidbankier) that analyzes your XML files, identifies IDs and Classes and automatically generates a template TSS file with said content. This small app is so useful that was recently merged into Alloy and will be available as one of Alloy’s official features. But you don’t have to wait to start taking advantage of it. You can start now and here’s how.

The tool is a Node.js script available via NPM. To install it, go to your terminal/command window and type:

sudo npm install -g xml2tss

This will install xml2tss globally in your computer. There are different ways of using it as explained in the GitHub Repo, but here’s the basic usage.

You can get the output echoed to the console:

xml2tss myviewfile.xml

You can also get the output to a file:

xml2tss myviewfile.xml > mystylefile.tss

On OSX you can output to the clipboard:

xml2tss myviewfile.xml | pbcopy

In any of these cases, the output is a properly formatted TSS file:

"#progressIndicator" : {

"#slider" : {

"#statusIndicator" : {

".container" : {


Next time you’re building a screen using Alloy, go ahead and type the View in XML with all its classes and Ids and give XML2TSS a try. You’ll see how useful it is.

Have your written a cool tool or utility? I’d love to check it out. Feel free to send it over to community@appcelerator.com.


  1. This looks cool but I get an error when trying to run it: Cannot call method ‘toString’ of undefined. Anyone else getting this?

Comments are closed.