1

If I use both bootsfaces and butterfaces in a single page, both libraries import their bundled jquery and bootstrap stylesheet as belows:

<link type="text/css" rel="stylesheet" href="/javax.faces.resource/bootstrap.min.css.xhtml?ln=butterfaces-configurable">
<link type="text/css" rel="stylesheet" href="/javax.faces.resource/css/bootstrap.min.css.xhtml?ln=bsf">

<script type="text/javascript" src="javax.faces.resource/jquery.min.js.xhtml?ln=butterfaces-configurable"></script>
<script type="text/javascript" src="javax.faces.resource/jquery.min.js.xhtml?ln=bsf"></script>

If both libraries use the same version , it waste bandwidth to import duplicate things. If both libraries use different versions , it is possible to have conflict. What is the best approach to deal with this? Can I selectively disable one component libraries to import certain stylesheets or scripts ?

Andrey
  • 6,526
  • 3
  • 39
  • 58
Ken Chan
  • 84,777
  • 26
  • 143
  • 172
  • Do you happen to use OmniFaces? – BalusC Jul 28 '15 at 17:43
  • Yes. I use Omnifaces . Do you mean to use CombinedResourceHandler? How about how to deal with the version conflict ? – Ken Chan Jul 28 '15 at 18:02
  • With CombinedResourceHandler you can indeed suppress resources via web.xml or even via a master XHTML template. But without it, there are other ways too, it only requires a bit of custom code. – BalusC Jul 28 '15 at 20:15
  • @KenChan (OT, but only slightly) You're the first person I know using both BootsFaces and ButterFaces - something I believed to be impossible because the two frameworks are so similar. Would you mind to contact me to report about your experiences? – Stephan Rauh Jul 29 '15 at 22:13
  • @Stephan . No problem. The reason I use ButterFaces is because I want to use its boostrap datetime picker. If BootsFaces also provides the boostrap datetime picker , then I don't need to use ButterFaces . Perhaps , I should open a ticket to request Bootfaces to have boostrap datetime picker too :P Finally , thanks for open source BootsFaces :D – Ken Chan Jul 30 '15 at 07:26
  • @KenChan You don't need to open a ticket - there already is one :). Please vote for [the time picker issue in our bug tracker](https://github.com/TheCoder4eu/BootsFaces-OSP/issues/144) (by leaving a comment). – Stephan Rauh Jul 31 '15 at 20:31

2 Answers2

3

you can use following web.xml parameter to disable providing jQuery in #ButterFaces.

<context-param>
    <param-name>de.larmic.butterfaces.provideJQuery</param-name>
    <param-value>false</param-value>
</context-param>

you can likewise disable bootstrap if you have your own version

<context-param>
    <param-name>de.larmic.butterfaces.provideBootstrap</param-name>
    <param-value>false</param-value>
</context-param>
Lars Michaelis
  • 559
  • 2
  • 6
  • 11
1

Update January 22, 2016: In the meantime, we (the BootsFaces team) went into some lengths to add fine-grained control over the resource loading. See http://www.bootsfaces.net/layout/resourcemanagement.jsf for details. Cutting a long story short, BootsFaces doesn't load jQuery, jQueryUI or Bootstrap if it detects these resources are already there. Plus, you can deactivate resource loading by an web.xml context parameters.

Outdated original answer: Currently, the only solution is to use OmniFaces, like BalusC said. We could offer to improve BootsFaces so that it adds jQuery.min.js and bootstrap.min.css only if these libraries aren't provided by the JSF page. In this case, ButterFaces would provide jQuery and BootsFaces. Of course, you'd be responsible to make sure that the jQuery version provided is compatible to BootsFaces.

Stephan Rauh
  • 3,069
  • 2
  • 18
  • 37