Migration path of JS/CSS resources from Plone 4 to 5

Hi there,

based on

http://docs.plone.org/adapt-and-extend/theming/resources.html
https://www.nathanvangheem.com/news/updating-javascript-for-plone-5

I tried to register my resources of an add-on (2 JS , 2 CSS files) with registry.xml.

The first thing: why can I register only one JS file as in

http://docs.plone.org/adapt-and-extend/theming/resources.html#resources

? It is possible to define more than one CSS file but only one JS is allowed (specifying multiple JS files using the element tag leads to an error in plone.supermodel...is this intentional or should be allowed to specify multiple JS files with a resource?

Second issue: I added my resource to the plone-legacy bundle and expected that this would be enough for make my JS code load (document.ready() handler is not executed). I can see the resource properly configured with the plone-legacy bundle...but no luck...is there any special build step need to get this working?

Third issue: until now it was possible to register one CSS file with the css_registry where the CSS file
could contain multiple @import statement for importing more specific CSS files. Is this still supported and doable in Plone 5?

Fourth issue: add-ons often contain your own JS/CSS code and third-party JS/CSS code where it is a no-go to touch the third-party code due to upgrade reasons. So code modifications and adjustments are only possible for our own code. Does it make sense to register own and 3rd party resources differently and perhaps assign a resource with own resources to the 'plone' bundle while 3rd party resources would be better suites for the 'plone-legacy' bundle?

Fifth issue: the "Develop CSS" and "Develop JS" buttons for a resource appear to be mutual exclusive...is this intentional?

Sixth issue: for supporting Plone 4.3 and Plone 5 within the same codebase I register dedicated profiles based on the availability of Products.CMFDefault

All common configurations were moved into a 'common' profile

while the profiles for 4.3 and 5.0 contain only the specific configuration (here js+css registries for Plone 4.3 and registry.xml for Plone 5).

The add-on will be installed with the Plone 4.3 or 5.0 specific profile where the related metadata.xml calls the 'common' profile

Does this approach make sense?

-aj

I think you can do

zcml:condition="have plone-5"

Multiple profiles makes sense to me, I would do that too.

-Roel