I'm not able to get my custom theme to run javascript on all pages. My code is as follows. My Custom module is enabled, and Component Libraries module is installed and enabled.
custom_theme.Libraries.yml
scripts:
# If this library had JavaScript you could specify it like this:
js:
js/script.js: {}
dependencies:
- core/jquery
global-scripts:
version: 1.x
js:
js/script.js: {}
custom_theme.info.yml
libraries:
- custom_theme/base
# @TODO Remove these libraries and use attach_library() for all component styles.
- custom_theme/scripts
- custom_theme/global-scripts
- custom_theme/box
- custom_theme/comment
- custom_theme/header
- custom_theme/hidden
- custom_theme/inline-links
- custom_theme/inline-sibling
- custom_theme/print-none
- custom_theme/responsive-video
- custom_theme/wireframe
- custom_theme/autocomplete
- custom_theme/collapsible-fieldset
- custom_theme/form-item
- custom_theme/form-table
- custom_theme/progress-bar
- custom_theme/progress-throbber
- custom_theme/resizable-textarea
- custom_theme/table-drag
- custom_theme/nav-menu
- custom_theme/navbar
- custom_theme/pager
script.js
/**
* @file
* A JavaScript file for the theme.
*
* In order for this JavaScript to be loaded on pages, see the instructions in
* the README.txt next to this file.
*/
(function (Drupal) {
'use strict';
Drupal.behaviors.my_custom_behavior = {
attach: function (context, settings) {
console.log("Hello World");
}
};
})(Drupal);