To be truly standalone, each pagelet should be able to specify its CSS and JS dependencies. The dependencies that are known statically can be concatenated & deduped by the controller and included in the head or foot of the document, as appropriate. The dependencies that are only known dynamically should be loaded by the pagelet itself. For example, the BigPipe.onPagelet method could be:
var BigPipe.onPagelet = function(placeholderId, contentId, cssDependencies, jsDependencies) { ... }
Using a tool like require.js, the onPagelet code could lod the cssDependencies and jsDepenencies before rendering this pagelet.
To be truly standalone, each pagelet should be able to specify its CSS and JS dependencies. The dependencies that are known statically can be concatenated & deduped by the controller and included in the head or foot of the document, as appropriate. The dependencies that are only known dynamically should be loaded by the pagelet itself. For example, the
BigPipe.onPageletmethod could be:var BigPipe.onPagelet = function(placeholderId, contentId, cssDependencies, jsDependencies) { ... }Using a tool like require.js, the
onPageletcode could lod thecssDependenciesandjsDepenenciesbefore rendering this pagelet.