Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dbankier/xml2tss

Alloy View XML to tss generator
https://github.com/dbankier/xml2tss

Last synced: about 1 month ago
JSON representation

Alloy View XML to tss generator

Awesome Lists containing this project

README

        

# xml2tss

Build an empty tss file from an Alloy view xml file

## Install

```
sudo npm install -g xml2tss
```

## CLI Usage

```
xml2tss [filename.xml]
```

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

**NEW**

```
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.

### to output to a file

```
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

### to clipboard (OS X)

```
xml2tss row.xml | pbcopy
```
## Library Usage

The `convertString`, `convertFile` and `updateFile` functions are available:

e.g.

```
var xml2tss = require("xml2tss");

xml2tss.convertString('',function(err,data) {
console.log(data);
});

xml2tss.convertFile('row.xml',function(err,data) {
console.log(data);
});

// will create or update the target row.tss
xml2tss.updateFile('row.xml','row.tss', function(err,data) {
console.log(data);
});
```

# Output

From this:

```



Add Item
Cancel

```

Generates this:

```
"#addBtn" : {

}
"#addWin" : {

}
"#cancelBtn" : {

}
"#itemField" : {

}
".again" : {

}
".button" : {

}
".container" : {

}
```