2

Ive always the Zen theme and added additional CSS and JS files in the page's tpl file, rather than using the .info file. Is their any performance or other downside to my method?

Thanks

1 Answer 1

3

Yes, the JavaScript cannot be aggregated meaning that instead of asking for a single (few) css/js files, the browser will have to ask for more files which is slower and required more work of your web server.

Depeding on how many JS and CSS files you add in your page.tpl.php you can get a noticeable performance improvement using the .info file method. It's also a lot better should you need to use your theme as a base theme, since it allows for better alters of the JS/CSS files.

2
  • OK thanks for that. Is aggregation the only performance benefit or is there something else with how drupal creates pages from all the various files used? Thanks
    – Evanss
    Mar 18, 2012 at 19:19
  • @jdln Drupal has a system for managin JS and CSS files added which opens up for a lot of possibilities, but it requires that you use the .info file or drupal_add_foo function.
    – googletorp
    Mar 18, 2012 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.