On Feb 15, 2010, at 10:33 AM, Hay (Husky) wrote:

> 
> Hi Gregory,
> i've tried that, but it doesn't work. I get a Freemarker error that
> "No signature of method renderTemplate matches the arguments". I guess
> because the 'js' variable you get in the #list method is a string, and
> not a Template type that renderTemplate() expects.

Oh, right - but then this should work:
  ${mgnl.renderTemplate(content[js])}


> I've tried manually
> getting the template using the 'cms.set' or 'cms.setNode' methods in
> the cms tag library, but that also doesn't seem to give the correct
> template.
> 
> Thanks,
> -- Hay
> 
> 2010/2/11 Grégory Joseph <[email protected]>:
>> 
>> 
>> On Feb 11, 2010, at 5:47 PM, Hay (Husky) wrote:
>> 
>>> 
>>> Hmm.. i tried this out but there is one big shortcoming: the
>>> InstallResourcesTask that i use in my ThemeInstallTask doesn't put the
>>> files in the tree in alphabetical order. Sometimes Javascript / CSS
>>> files need to be loaded in a specific order (e.g. the jQuery library
>>> should be loaded before you load any plugins), and that doesn't work
>>> then.
>>> 
>>> One workaround would be to adapt the all.js 'template' and include the
>>> files by hand, but i couldn't figure out how to get a specific
>>> resource from the tree by using the cms tag library. Can anybody give
>>> me any pointers on that?
>> 
>> If I got you right, instead of doing ...
>> [#list content?children as subnode]
>>    ${mgnl.renderTemplate(subnode)}
>> [/#list]
>> 
>> ... you could do something along the lines of ...
>> [#assign orderedJS = ["jquery", "jquery-plugin-a", "jquery-plugin-b"]>
>> [#list orderedJS as js]
>>    ${mgnl.renderTemplate(js)}
>> [/#list]
>> 
>> http://freemarker.org/docs/ref_directive_list.html
>> 
>> HTH,
>> 
>> -greg
>> 
>> 
>>> 
>>> Thanks,
>>> -- Hay
>>> 
>>> On Thu, Feb 11, 2010 at 11:31 AM, Hay (Husky) <[email protected]> wrote:
>>>> Hi everyone,
>>>> a question about frontend development. I've been experimenting with
>>>> the CSS/JS nodes in my resources folder and theme definition. One of
>>>> the things i'm currently trying to implement is to write aggregator
>>>> freemarker templates for CSS/JS to easily organize my CSS and JS files
>>>> in folders and then aggregate them on the fly, which simplifies
>>>> development and also makes the site faster, because the browser only
>>>> needs to do two requests (for the combined CSS and JS files) instead
>>>> of a request for every single file. I've included the template at the
>>>> bottom of this mail, maybe it is useful for somebody.
>>>> 
>>>> To make development even more easier it would be very helpful if there
>>>> would be some way to do a 'recursive bypass' for all files included
>>>> using the template. You can use the 'bypass' flag on the file dialog
>>>> to load files from the filesystem, so you can edit the CSS/JS files in
>>>> your favourite editor instead of using the dialog. However, when
>>>> checking the bypass flag on the aggregated freemarker template it only
>>>> bypasses this single file, and you still have to set the flag on all
>>>> child nodes. This was to be expected, but i was just wondering if
>>>> there is some way to solve this problem so you can have a good
>>>> development setup.
>>>> 
>>>> Thanks,
>>>> -- Hay Kranen, frontend developer VPRO Netherlands
>>>> 
>>>> My aggregator template:
>>>> 
>>>> [#--
>>>>    This Freemarker template aggregates all files recursively, even in
>>>>    subfolders, and cats them all together, with some nice descriptive 
>>>> comments
>>>>    and compresses it on the fly as well
>>>> --]
>>>> 
>>>> [#macro recurseTree parent]
>>>>    [#list parent ? children as child]
>>>>        [#if child ? node_type == "mgnl:folder"]
>>>>            /********* ${child} (${chi...@handle}) ********/
>>>>            [...@recursetree child /]
>>>>        [#else]
>>>>            /* ${child} (${chi...@handle}) */
>>>>            ${mgnl.renderTemplate(child)}
>>>>        [/#if]
>>>>    [/#list]
>>>> [/#macro]
>>>> 
>>>> [#-- Start recursing --]
>>>> [#compress]
>>>>    [...@recursetree content /]
>>>> [/#compress]
>>>> 
>>> 
>>> ----------------------------------------------------------------
>>> For list details see
>>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>>> To unsubscribe, E-mail to: <[email protected]>
>>> ----------------------------------------------------------------
>> 
>> 
>> ----------------------------------------------------------------
>> For list details see
>> http://www.magnolia-cms.com/home/community/mailing-lists.html
>> To unsubscribe, E-mail to: <[email protected]>
>> ----------------------------------------------------------------
>> 
>> 
> 
> ----------------------------------------------------------------
> For list details see
> http://www.magnolia-cms.com/home/community/mailing-lists.html
> To unsubscribe, E-mail to: <[email protected]>
> ----------------------------------------------------------------


----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to