Note: This documentation assumes you are running your installation with IN_DEV enabled.
Development & production
Global resources are those that are loaded on every page load. This includes:
- Libraries - jQuery, Underscore etc.
- Application setup - Bootstrap module, loader module, base controller etc.
- Global modules - UI widgets, utilities, global controllers etc.
- Front/admin modules - Controllers global to the front-end/admin control panel, needed on every page in that area.
All of the above files are located at <root>/dev/js/.
Bundles for an application are built based on folder/filenames, and use the format <location>_<directory>.js. Taking the structure above as our example, if we loaded front_profile.js, it would contain:
This bundle would then be included in your PHP code like so:
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'front_profile.js', 'core' ) );
An application has an interface directory at <appName>/interface/. This is where third-party libaries used by individual applications should be stored and loaded from. They are not bundled or minified by IPS4, so you should store the pre-minified rather than the uncompressed version.
Assuming you had added a file to interface at <appName>/interface/jquery/jquery.rangyinputs.js, it can be included in your PHP code like so:
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'jquery/jquery.rangyinputs.js', 'appName', 'interface' ) );