Diem snippets syndication

Include JavaScript files in the <head> section

February 4, 2010 by Thibault D

By default with Diem, all JavaScript files are compressed and combined into one file. This file is loaded just before </body>, as recommended by Yahoo Best Practices.

Some symfony plugins write JavaScript code directly into the HTML. They expect jQuery to be loaded before their JavaScript code executes.
So we need a way to include jQuery from <head> section in order to make these plugins work.

Add the assets you want to include in <head> to the js head_inclusion configuration:


    compress:             true  
      enabled:            false  
    head_inclusion:       [ lib.jquery ]  

Add a comment


  • SandorNovember 10, 2012 10:43 AM


    Could you shed some light on the syntax of head_inclusion param?

    Is it the filename? Is it with/without extension? Is it a relative path to which dir?

Fork Diem on GitHub