Adding JS to a Drupal 8 theme (replacement for drupal_add_js)
It seems you can use hook_preprocess_page with attached as such:

function MYTHEME_preprocess_page(&amp;$vars, $hook) {
  $path = drupal_get_path('theme', 'MYTHEME');
     // Render the main scripts file.
  $local_js = array(
    '#attached' =&gt; array(
      'js' =&gt; array(
        $path . '/js/scripts.js' =&gt; array(
          'group' =&gt; JS_THEME,
          'weight' =&gt; 9999),
      ),
    ),
  );
  \Drupal::service('renderer')-&gt;renderRoot($local_js);
}


This works great (theme.inc uses this method), note the extra nested array around the weight.