Hi Stef, I would prefer #2. #1 feels a little less clean, what with misusing the conditionalComment.
2 more thoughts: - we use a template area to make configurable inline-javascripts in the page-head. By default the area is switched off in the prototype, but if we need custom js code in a template, we create a template script for it and configure it for that area. That area then gets rendered within the html head tag. You could do something similar for the bottom of the page. - if loading of multiple files is the problem, you can use magnolia's "processed javascript" resource type to create a "meta-script" that simply includes all of its children and serves them as one file. In this way multiple js files can be delivered to the client in one request (see magnolia's "all.js" for an example). Regards from Vienna, Richard -----Ursprüngliche Nachricht----- Von: [email protected] [mailto:[email protected]] Im Auftrag von Stef te Winkel (via Magnolia Forums) Gesendet: Donnerstag, 16. August 2012 12:24 An: Magnolia User List Betreff: [magnolia-user] Multiple jsFiles groups in STK? Dear forum readers, I'm facing the following challenge: I'd like to create a prototype template in STK with javascript-includes on two different places of the page: one in the head and one just before the closing of the body tag. In development mode this will be a list of javascript files on both positions, in production this will be just 2 minified javascript files on those positions. To make this possible I found two possible solutions, but both don't feel good. 1. Place all the javascript-files in the Themes/jsFiles pointing to the resources, but add for each of them an additional node data "conditionalComment"in which is specified whether this is a header, body or one of the two minified js files, and filter on this in looping the listing. This solution 'misuses'the conditionalComment node data, and you'll have to loop all jsFiles twice. On top of that you'll create a dependency between the chosen name in the configuration and the code. 2. Place the Head javascript files in the Theme and place the body jsFiles in the jsFiles node under the prototype-Template. Retrieve the head ones with the theme, and the body ones with the "def" object. This solution lists the JS files in two diferent locations, and 'misuses' the jsFiles node for exceptions. Anybody knows of a better alternative? If not, which of the two above should I choose? Thanks in advance! Kind regards, Stef -- Context is everything: http://forum.magnolia-cms.com/forum/thread.html?threadId=fc8b9ebf-378a-4369-9efb-c9f529f34ab5 ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ---------------------------------------------------------------- ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <[email protected]> ----------------------------------------------------------------
