Adding custom JavaScript to a custom theme

To increase customization of the Developer Portal, you can add custom JavaScript to custom themes that you install.

Procedure

  1. Add your JavaScript file to your theme. For example, in a sub-directory named js and the file myfilename.js.
  2. Add the JavaScript file to your theme, by editing your {custom_theme}.libraries.yml file and adding in the JavaScript file.

    An example of the JavaScript file:

    myfile:
      js:
        js/myfilename.js: {}
  3. Add the following code to your theme's .info.yml file:
    libraries:
    - {custom_theme}/myfile
    Note: You must replace {custom_theme} with your theme name. Also, both files must reference myfile.
  4. Zip up the directory and upload it to your portal site. For more information, see Installing additional themes.