I'm trying to add external JavaScript to my Drupal 8 theme. Can someone tell me what I'm doing wrong here? This function is in my MYTHEME.theme file:
function MYTHEME_preprocess_page(&$variables) {
$vars['ext_js'] = array(
'#attached' => array(
'data' => 'http://cdn.somelibrary.com/library/2.3.1/js/jslibrary.min.js',
'options' => array(
'preprocess' => TRUE,
'every_page' => TRUE,
'group' => 'NONE',
),
),
);
}
Then in the theme I'm rendering it with:
{{ ext_js }}