Can I add CSS to a YAML generated page ?
You can still use the hook_preprocess_page for a specific path like this:

/**
 * Implements hook_preprocess_HOOK().
 * Implements hook_preprocess_page().
 *
 * @param $variables
 */
function mymodule_preprocess_page(&amp;$variables) {
  $current_path = \Drupal::service('path.current')-&gt;getPath();
  if ($current_path === '/solr-search/content') {
    $variables['#attached']['library'][] = 'my_module/my-css-library';
  }
}