By vikeshmittal on
Hi,
I am working on a functionality which requires a JS file defined in '/sites/all/libraries/SOMEFILE.js' to be included on all pages of the site. Now this JS is not part of any module or even theme. So what should be the best way to include this file?
I know that we can add this in hook_theme() but I don't want to make this part of theme as in future there may be 10-15 more JS files like this and adding all those from hook_theme() will not be a good practice.
Also it is not recommended to include such files from hook_init().
Thanks,
Vikesh M
Comments
Actually, if the files need
Actually, if the files need to be included on all pages, and you don't want to do it in a theme, you would add the script in hook_init() in a custom module. The only other option is to add it in your theme, using the info file. These are your two options, pick the one that works better for you.
Contact me to contract me for D7 -> D10/11 migrations.
Look into the Libraries API :
Look into the Libraries API : http://drupal.org/project/libraries