Bootstrap and Nitrogen - are these scripts and CSS necessary or can I remove them?

Hi,

I am interested in using Bootstrap to style my page. I know from experience that it is recommended not to use jQuery when using Bootstrap as it can cause conflicts. Looking at the bare.html template I see a lot
of calls to jQuery scripts and CSS:

<script src='/nitrogen/jquery.js' type='text/javascript' charset='utf-8'></script>
  <script src='/nitrogen/jquery-ui.min.js' type='text/javascript' charset='utf-8'></script>
  <script src='/nitrogen/livevalidation.min.js' type='text/javascript' charset='utf-8'></script>
  <script src='/nitrogen/nitrogen.min.js' type='text/javascript' charset='utf-8'></script>
  <script src='/nitrogen/bert.min.js' type='text/javascript' charset='utf-8'></script>
  <link rel="stylesheet" href="/nitrogen/jquery-ui/jquery.ui.all.css" type="text/css" media="screen" charset="utf-8" />

Are these scripts and CSS necessary or can I remove it? If not what is the best way to use Bootstrap with jQuery?

2 Likes

I get the feeling from the fact that no one has replied that using Bootstrap with Nitrogen “isn’t the Erlang way”. Also, there is this gem that makes me think the same.

1 Like

Hi, sorry, I’ve been traveling for work the past few days.

Currently, Nitrogen does rely on jquery pretty heavily, though that has nothing to do with the “Erlang way,” more just a remnant of its history.

That said, I’ve not had much trouble integrating Bootstrap with Nitrogen apps (though I don’t think I’ve tinkered with Bootstrap 5 much - so maybe the new version gives trouble). Indeed, I maintain a Nitrogen plugin library that gives elements for a small subset of bootstrap elements (GitHub - choptastic/coldstrap: Bootstrap for Nitrogen Web Framework).

There are plans to explore removing jquery from Nitrogen, but it’s not a trivial task at the moment.

A shorter term plan might be just to have Nitrogen’s jquery use a different variable than the default $, but again, this is just talk at the moment - an item on the trello board.

2 Likes