How to attach custom CSS to a Views output? I created a View to list a custom entity content.
I'd like to add my custom CSS file to the generated page.
I tried to use a Text Area in the footer with {{ attach_library('amap/yyy') }} where amap is my custom module and yyy is my custom library.
And of course, the CSS is not loaded...
Any idea why?
You will need hook_views_pre_render().

And here is an example:

/**
 * Implements hook_views_pre_render().
 */
function base_views_pre_render(ViewExecutable $view) {
  if($view-&gt;id() == 'this_is_my_view_with_no_css' &amp;&amp; $view-&gt;current_display == 'page_1') {
    $view-&gt;element['#attached']['library'][] = 'base/test';
  }
}