Currently I am using javascript to convert the URL into a unique body class. This helps to target sub sites for unique branding without impacting the entire site. Is there a way to do this without javascript? Below is what I am using now.
//add body class
// find the pathname
var urlPath = window.location.pathname;
//convert to lowercase
urlPath.match(/\/(.*?)(\+|$)/)[1].toLowerCase();
// remove the first character
urlPath = urlPath.replace(/\//g, '-').slice(1);
//remove file extension
urlPath = urlPath.replace(/\.[^/.]+$/, "");
// add class to body
$(document.body).addClass(urlPath);
An article explaining the issue in more detail - https://blog.mastykarz.nl/webdesigners-sharepoint-body-id/
In WordPress you can do the following
<body <?php body_class(); ?>>
Then designers can target individual pages and pages that use a particular template
<body class="page page-id-2 page-parent page-template-default logged-in">