How to attach a library to a specific content type?
You can check content type and add libraries like this:

function fluffiness_preprocess_node(&amp;$variables) {
  $node = $variables['node'];
  //check content type
  if ($node-&gt;getType() == 'article') {
    $variables['#attached']['library'][] = 'fluffiness/cuddly-slider'; 
  }
}