Use viewhelper in a fluid template:
<f:be.container
addJsFile = "{f:uri.resource(path:'js/script.js')}">
</f:be.container>
UPDATE:
As @biesior mentioned (thanks!), The method is addJsFiledeprecated. The following is an example of using the new and recommended be.container viewhelper method includeJsFiles. This new feature may include multiple JS files instead of one:
<f:be.container
includeJsFiles = "{0:'{f:uri.resource(path: \'js/script1.js\')}', 1:'{f:uri.resource(path: \'js/script2.js\')}'}" >
</f:be.container>
See the relevant Fluid viewhelper Documentation .
source
share