tidev/alloy

Widgets need to be able to bundle assets and libraries

Closed this issue · 3 comments

Right now at compile time, a widget's view and controller are used to create a component commonjs module that gets put into Resources/alloy/widgets/WIDGETID/components. That component commonjs module can be used to create self-contained instances of the widget in alloy-driven apps.

We also need to add Resources/alloy/widgets/WIDGETID/assets and Resources/alloy/widgets/WIDGETID/lib directories to allow these types of resources to be accessible at runtime as well.

Potential issues

  • How do we handle paths to these assets? If they are going to be moved to a widget-specific directory, which should be done to avoid collisions, how will we handle file, image, etc... paths inside the widget code and styles?

I think we follow the convention of /file_or_path when we copy into Resources

But we don't want to dump the assets for each widget directly into the main Resources directory because this will likely create collisions with asset filenames at some point. We need to keep a widget's assets in a widget-specific directory. We need to come up with a way to prevent collisions, but still let the developer specify all paths for requires, files, assets, etc... as relative to the widget root.

I meant that we put them under a widget dirname under resources