In my Drupal themes' folder I've created a file named "custom-js.js".

I created this file to use 2 jQuery manipulations on a small text block that appears in all pages of the site.

My question is, how do I enable this JS file? How do I "link it" with Drupal, so that it's actually being used in my site?


1 Answer 1


There are several ways to add JS files to Drupal, depending on the requirements.

If the JS is related to your theme and used on every page, perhaps easiest to add the file to your theme's .info file

  1. create the JS file in mytheme/custom-js.js and configure it for the theme in mytheme.info

    scripts[] = js/custom-js.js

  2. Flush all caches to register the new JS file.

More info: https://www.drupal.org/node/756722