Skip to content

Instantly share code, notes, and snippets.

@jasonkneen
Last active November 28, 2016 14:26
Show Gist options
  • Save jasonkneen/0f09114f4913c00512f9 to your computer and use it in GitHub Desktop.
Save jasonkneen/0f09114f4913c00512f9 to your computer and use it in GitHub Desktop.
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 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 --…
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;
<Alloy module="elements">
<Window>
<Label>Hello!</Label>
</Window>
</Alloy>
@falkolab
Copy link

falkolab commented Sep 7, 2015

it would be nice like:

<Widget src="my.widget" module="lib.from.widget>
   <CustomTag />
</Widget>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment