Requirements
What I needed to do was to find a way to reuse custom UI components (widgets) in the most transparent way. That meant for me that I should be able to:
* Not have to declare all of my widgets dependencies in each webpage it was needed.
* Have all widget code in their own files. This applies to JavaScript source as well as HTML templates.
* Have each widget specify its dependencies to other widgets so I can easily compose them.
Gather the tools
Using an MVW framework is always a good idea when trying to structure your Web UI code. It separates your JavaScript from your HTML views in a clear way, so I tried a few. What I finally ended up using was Knockout.js, because of its HTML templates with data-bind tags. That was making it easier for a designer to work with them without messing with Handlebars magic.