Add class name to body class

In the case below we add the is-node as well as the node ID to the body class.

/**
 * Implements hook_preprocess_html().
 */
function _preprocess_html(&$variables) {
  if (($node = \Drupal::request()->attributes->get('node'))) {
    $variables['attributes']['class'][] = 'is-node';
    $variables['attributes']['class'][] = 'nid-' . $node->id();
  }
}