Power Pages – what if you did not want to use bootstrap 5?

By | August 12, 2024

So here is the thing. Depending on what you want to get out of Power Pages, there may come a time when Bootstrap5 will start getting in your way. Weird as it sounds.

If you’ve been following my recent posts, they’ve mostly been about getting GC Web “implemented” with Power Pages. And I’ll continue with that soon.

However, that theme is not compatible with bootstrap 5, which is what Power Pages use when they are on the Enhanced Data model.

So what do you do?

Well, you either go back to the standard data model (bootstrap 3), which is probably not what you want, or… you get rid of bootstrap 5. Along the way, you probably have to assume 90% of the out of the box components will stop working (lists, forms, powerbi, Sharepoint, etc). But, on the other hand, I already mentioned here we’d likely need to use custom lists and forms anyways.

So, the script below will take care of removing bootstrap5 “references” (along with the basic portal theme):

$(document).ready(function(){
  $("link[href*=BootstrapV5").remove();
  $("script[src*=BootstrapV5").remove();
  $("link[href='/portalbasictheme.css'").remove();
  $("link[href='/theme.css'").remove();
});

Actually, you can’t help but get bootstrap5 loaded because it’s pretty much hardcoded into Power Pages. What you can do is get it “removed” after that, which is what the script above does.

And I think I have some idea of what you are thinking, but, well, we do what we have to do…

Leave a Reply

Your email address will not be published. Required fields are marked *