0

Where is it best advised to include JavaScript and CSS files, in the case you have a theme and a sub-theme? Does it have the same effect when you use those files from a .info file, a template file, or a module?

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
arteta
  • 33
  • 5

1 Answers1

3

For JavaScript files, the files are being grouped by where they are called from. Below is the order in which they are called.

  1. Libraries: Libraries, settings, or jQuery plugins
  2. Modules: Javascript files added by modules
  3. Themes: Javascript files added by theme (like in .info files)

See the description for $options given in drupal_add_js().

For CSS files, there are three groups too.

  1. System layer CSS files (e.g. modules/system/system.menus.css and modules/system/system.theme.css)
  2. CSS files added by modules
  3. CSS files added by themes

See the description for $options in drupal_add_css().

Muhammad Reda
  • 26,379
  • 14
  • 93
  • 105
  • tanx for the useful info @Muhammad Reda.but i would like to know if there is any difference in action when adding the javascript and css files in .info,.module,template files... – arteta May 19 '13 at 14:14
  • The only difference will be due to the **order of execution**, which is illustrated above. – Muhammad Reda May 20 '13 at 07:54