Ordering resources in a bundle

In Plone 5, how can I enable and ORDER a resource, for instance in plone-legacy, from my site addon?

I want to activate resource-plone-app-jquerytools-js. Without adding RequireJS wrappers, I guess it can only go in plone-legacy bundle, and I also need it in a certain position: after resource-plone-app-event-event-js. I can make that TTW by drag'n'dropping the resource, but exporting with portal_setup wouldn't suffice cause in my addon I'd like to use purge=false, like this:

<?xml version="1.0"?>

  <records prefix="plone.bundles/plone-legacy"
    <value key="resources" purge="false">


Is something like insert-after possible? If not, should we implement it?

Also I don't understand why conditions per resource aren't available/weren't implemented. It seems I can only apply conditions per bundle so if an addon has 2 CSS and 1 JS and they all need different conditions I'll have to have 3 bundles? Please someone tell me I understood wrong.

If using legacy and you need to manage order, you should probably just use jsregistry.xml instead. I'm not sure plone.app.registry has support for ordering. Maybe someone else can touch on that.

Yes, this is correct.

Yes, or you just manually include them on your view by using the add_bundle_on_request, remove_bundle_on_request or add_resource_on_request. See http://docs.plone.org/adapt-and-extend/theming/resourceregistry.html#controlling-resource-and-bundle-rendering for more details

1 Like