The documentlist.get.html.ftl template uses the group attribute in the <@link>, <@script>, <@inlineScript> and <@createWidgets> directives. This attribute determines the order in which dependency requests and JavaScript code are output into the rendered HTML page.
Surf supports the ability to aggregate multiple files into a single resource to reduce the number of HTTP requests made by the client, in order to increase page loading performance. The group attribute is used to determine how dependencies are aggregated into the generated resources. Managing the groups is important because once generated a resource is cached on the server to improve response times for subsequent requests. If a single group were to be used then only one HTTP request would be made per page, but the performance gained through reduced requests would be lost to server side aggregation for each request.
In order for the same Share code to be able to support different Surf operation modes the group attribute is also applied when processing individual dependency requests. Groups are output in the order they are requested and all the dependency requests and code are output for each group in turn.
By way of example, for the following HTML:
<@scriptsrc="/aaa.js"group="1"/> <@script src="/bbb.js" group="2"/> <@script src="/ccc.js" group="3"/> <@script src="/ddd.js" group="2"/> <@script src="/eee.js" group="1"/>
The output is:
<scriptsrc="/aaa.js"></script> <script src="/eee.js"></script> <script src="/bbb.js"></script> <script src="/ddd.js"></script> <script src="/ccc.js"></script>