Add CSS/JS to particular view? I'm having trouble understanding how to attach a library to views.  I want my assets to be included in /foo but not in /bar.  I've read through the documentation on this more than once and from my understanding this is achieved by using preprocess, such as:

function my_theme_preprocess_page(&amp;$variables) {
  if($variables['is_front']){
    $variables['#attached']['library'][] = 'my_theme/my_library';
  }
}


I'm new to Drupal so forgive my inherit ignorance, but what does $variables contain?  'is_front' is easy enough, but how do I apply this to views or content types? 

Thank you all in advance.
but what does $variables contain?  


A couple of render arrays and some values that be used by twig template. Your best option is check de documentation for each preprocess function to see what are included in $variables. Docs link template_preprocess(&amp;$var) better explanation about preprocess functions and default list of template preprocess functions


  but how do I apply this to views or content types?  


For me the best option is your twig template file by including this line.

{{ attach_library('my_theme/my-library') }}


No matter how many times this will be 'attached' only one will be downloaded (or aggregate). And only will added if this particular template will be rendered.

More info about Twig debug is here