If you want to use your own convention, you can override the way that the Widget plugin loads its parts relatively easily. For example, if you wanted your convention to be that both the view and view model of the widget were named after the widget's kind, you could do this:
define(["plugins/widget"], function (widget) {
// Look in 'widgets/[kind]' for '[kind].html' and '[kind].js'
var convertKindToKind = function (kind) {
return "widgets/" + kind + "/" + kind;
};
widget.convertKindToModulePath = convertKindToKind;
widget.convertKindToViewPath = convertKindToKind;
});
Alternatively, you can use the mapKind
function for a "one-off" non-conventional widget mapping:
// Parameters are: Widget kind, viewId, moduleId
widget.mapKind("mywidget",
"widgets/mywidget/mywidget",
"widgets/mywidget/mywidget");