Pergunta

Drupal 7 adds a new 'weight' option to drupal_add_js so that you can control the order in which Javascript files are added to the page. Is there any way to do this when adding Javascript in .info files?

Foi útil?

Solução

But to answer the actual question, the order that the files are included in the .info file should be the order that they appear on the page.

Outras dicas

Despite its instructions to not use it for adding JS to every page, hook_init() will allow you to add JS in an more sophisticated way with drupal_add_js().

That said, it is rare that a JS file must be loaded on EVERY page, so there is likely more optimization you can do. Also see the FAPI property #attached for adding JS to a form.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a drupal.stackexchange
scroll top