konstantinbueschel
8/28/2015 - 2:24 PM

In the latest TiAlloy you can specify a module tag against the <Alloy> element in XML and this will be used when creating any elements in th

In the latest TiAlloy you can specify a module tag against the element in XML and this will be used when creating any elements in the view, so you can override, customise etc. The problem is if you want to use multiple commonJS libraries, there's no support in the Alloy Tag -- you'd have to change the module attribute for each element -- here's a workaround.

<Alloy module="elements">
  <Window>
    <Label>Hello!</Label>
  </Window>
</Alloy>
var o = {};

// include the modules you want - purposely did this as seperate lines so it's easier to comment out modules etc

_.extend(o, require("module1"));
_.extend(o, require("module2"));
_.extend(o, require("module3"));

// make available under a single export for use in <Alloy> tag
module.exports = o;