Alloy View XML to tss generator


Build an empty tss file from an Alloy view xml file

sudo npm install -g xml2tss
xml2tss [filename.xml]

converted file is returned to stdout (so you can build your own editor plugin)


xml2tss [filename.xml] (filename.tss)

if a target tss file is supplied it will write the output to the target tss file. If the file already exists it will update the file appending to the end the missing ids and/or classes.

xml2tss row.xml > ../styles/row.tss

or new

xml2tss row.xml ../styles/row.tss

the second command will create or update the target file with the missing tags

xml2tss row.xml | pbcopy

The convertString, convertFile and updateFile functions are available:


var xml2tss = require("xml2tss");
xml2tss.convertString('<Alloy><Win id="win"/></Alloy>',function(err,data) {
xml2tss.convertFile('row.xml',function(err,data) {
// will create or update the target row.tss
xml2tss.updateFile('row.xml','row.tss', function(err,data) {


From this:

  <Window id="addWin" title="Add Item" class="container" modal="true">
    <TextField id="itemField" hintText="What do you need to do?" />
    <Button id="addBtn" class="button again">Add Item</Button>
    <Button id="cancelBtn" class="button" class="two">Cancel</Button>

Generates this:

"#addBtn" : {
"#addWin" : {
"#cancelBtn" : {
"#itemField" : {
".again" : {
".button" : {
".container" : {