I am using the jQuery Easing plugin (http://gsgd.co.uk/sandbox/jquery/easing/) for one of my Drupal 7 themes. I see that there is a Libraries module that loads this plugin in a way that allows other modules and themes to use it: http://drupal.org/project/jqeasing.

Is this the correct way to load the library?

After loading the library, Do I need to explicitly call drupal add js from the template.php theme file? The documentation for the Libraries module for theme development is terrible. I may contribute to it, once I get this sorted out.

2 Answers 2


Yea using a module that exposes it as a library is totally the way to go.

And you certainly don't want to use drupal_add_js because drupal_add_library [link] will do it the proper way.

And for your case:

drupal_add_library('jqeasing', 'easing');
  • Just an after thought, it would be really cool if you could put a library in the theme's .info file. You could add it in the scripts[] array, but it isn't really proper. Commented Nov 12, 2012 at 21:10
  • I have this in my template.php for my Drupal 7 theme - function Mytheme_preprocess_html(&$variables) { if (drupal_is_front_page()) { drupal_add_js(drupal_get_path("theme", "Mytheme") . "/test.js"); drupal_add_library("jqeasing", "easing"); } } It's loading my test.js file on the frontpage, but not the jqeasing library. Am I missing something? Commented Nov 12, 2012 at 22:16
  • You may be able to do it with just drupal_add_library("jqeasing"); Commented Nov 15, 2012 at 20:23

inside the template.php file

Mytheme_preprocess_html(&$variables) { if (drupal_is_front_page()) { libraries_load("easing"); } }

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.