Manifesto loads a default Javascript file, app.js
, through the global/includes/page_head.inc
file. This javascript includes the Foundation javascript files, jQuery, and some other scripts that Manifesto requires to run properly. That javascript file is loaded in the <head> section of your pages, in part to ensure that jQuery and other dependencies are loaded before any other javascript appears.
Custom javascript, however, is designed to be added just above the closing </body> tag in your pages, to prevent any page loading delays that may result from attempting to load and execute the javascript earlier in the page load.
The global/includes/page_head.inc
file looks, by default, for a (usually minified) file called local-min.js
in the /js/
directory of the current theme. To add your own custom javascript, you have 3 main options:
- Add your javascript to a file called
local.js
in a theme directory/js/
(create the directory if necessary). Minify the file to the same directory, naming itlocal-min.js
. Manifesto will detect and load it automatically. - Add your javascript to
[theme]/js/local-min.js
(whether it's really minified or not), and Manifesto will detect and load it. - Add your javascript to
whatever-you-want.js
and then edit theglobal/includes/page_head.inc
to include a new line which injects your custom js file in the same manner as local-min.js, as seen below.
global/includes/page_head.inc (before)
global/includes/page_head.inc (after)