Problem/Motivation
Add route to body as class name
Proposed resolution
add to THEME_preprocess_html(&$variables) in *.theme file:
$route_name = \Drupal::routeMatch()->getRouteName();
$route_class = Html::cleanCssIdentifier(str_replace('.', '-', $route_name));
$variables['attributes']['class'][] = 'page-route-' . $route_class;
Issue fork bootstrap5-3570047
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jannakha commentedCSS classes added to
<body>:can be used in custom styling like:
Comment #4
vladimirausThanks for your contributions. Applies and works.
Comment #5
vladimirausThank you for contribution. Committed.