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(&$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.