Requirejs feels a bit overkill, given that I have no dependencies such as jquery.
less than 10 lines of JS.
The majority of my JS/CSS code in templates looks like this:
Very old style, perhaps weird...but it just works out of the box for all and everything and I don't have to care about the various weird things in the context of resource registries. In particular I can add and change things easily and very fast.
Working for 99.9% of all cases and I don‘t care about the remaining 0.1%. If there is a real need for cache invalidation then I flush my varnish. Life is too short wasting it with resource registry issues. Customers are not willing to pay me for hours and days for finding workarounds when dealing with resource registry issues. We need solutions that are robust and working. That is the case here.
Interesting views. I would have thought that something could be added to bobtemplates.plone to set up the resource registry settings (probably with compilation turned off), the bundle JS, and a template JS file with require js boilerplate.
That should be simple to operate as the diazo or template slot filling methods outlined above, and IIUC would handle caching better.
I thought the (only) point with requirejs is 'dependencies'.(?) And if this is only for one browser view (I am just guessing it is ) and the script is so small: I would say: put it in inline the template (and probably at the bottom to load faster (?).
Also: I think the script might be (theoretically) slightly faster if you can use an id as selector (since there is only one id with the same 'id' the script does not have to 'keep looking through the DOM)