drupal 8 attach script to particular node code example Example: drupal 8 attach js library $variables['#attached']['library'][] = 'your_module/library_name';