Code snippet that can be used to pass variable to html.html.twig in Drupal 8.
/**
* @param $variables
*/
function mymodule_preprocess_html(&$variables)
{
$node = \Drupal::routeMatch()->getParameter('node');
if ($node) {
$variables['node_id'] = 'node-' . $node->id();
}
}
Print the value in html.html.twig like this:
{{ node_id }}