I am new to grails and I ran into the same problem, trying to apply a style to my g:paginate. I solved it with JQuery.
First encapsulate my directive g:paginate within a div with id gPaginate this in order to get the children it has, that is, go to each of the elements of my directive.
<div id="gPaginate">
<g:paginate maxsteps="4" controller="reservations" action="searchReservations" total="${totalReservations}" max="5" params="${parameters}" prev="<" next=">" />
</div>
<nav id="pagination2" aria-label="Paginación">
<ul id='gPaginate2' class='pagination'></ul>
</nav>
Then I created my list and I was adding each child of my directive in another div with an ul to which its id is gPaginate2 to validate by adding a
and validating if the item (child) contains the currentStep style then assign my class page- link active
In short it is to pass the items of the paginate directive to another one but with the style you want and finally hide the g: paginate I hope it serves you I leave you the JQuery code.
$(document).ready(function() {
$('#gPaginate').children().each(function(index,html) {
if($(this).hasClass('currentStep')){
$('#gPaginate2').append("<li id='item"+index+"' class='page-item active'>");
}else{
$('#gPaginate2').append("<li id='item"+index+"' class='page-item'>");
}
$(this).clone().appendTo($("#item"+index));
});
$('#gPaginate2').children().each(function() {
$(this).children('a').removeClass("step");
$(this).children('a').addClass("page-link");
$(this).children('span').removeClass("step gap");
$(this).children('span').addClass("page-link");
});
$('#gPaginate').hide();
});
result