[ALOY-130] Interpret .tss files as JS, not JSON
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | High |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2012-07-26T13:24:04.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | XML |
Labels | n/a |
Reporter | Tony Lukasavage |
Assignee | Unknown |
Created | 2012-07-26T08:45:33.000+0000 |
Updated | 2018-03-07T22:25:42.000+0000 |
Description
This will allow styles files to lose the enclosing \{\} characters, and it will remove the need to wrap all properties in quotes. All the same compile time rules will apply though. All dynamic code still needs to go in expr() syntax. We can likely achieve the above by using eval() on the style, then using JSON.stringify() to turn it back to JSON, then continue are normal tss processing.Comments
- Tony Lukasavage 2012-07-26
For reference, the
test/apps/simple/styles/index.tss
before and after. No more double quotes necessary on keys, and no top-level \{\} necessary.before
{ "Button" : { "width" : expr(Ti.Platform.displayCaps.platformWidth/2), "height" : Ti.UI.SIZE }, ".button" : { "randomProp":"OK" }, "#index[platform=ios]": { "backgroundColor":"blue" }, "#index[platform=ios size=tablet]": { "backgroundColor":"red" }, "#b": { "randomProp" : null } }
after
"Button" : { width: expr(Ti.Platform.displayCaps.platformWidth/2), height: Ti.UI.SIZE }, ".button" : { randomProp: 'OK' }, "#index[platform=ios]": { backgroundColor: 'blue' }, "#index[platform=ios size=tablet]": { backgroundColor: 'red' }, "#b": { randomProp: null }