The BootsFaces jar contains many CSS and JavaScript files. You don't need external resource files to use BootsFaces. However, many developers and web designers aren't happy with that. These are basically the reasons for using external resources:
To serve all these requirements, we've implemented quite a few options to influence which files are loaded and which are not.
In general, BootsFaces goes into some lengths to decide which libraries to load, and when. Among other things, BootsFaces modifies the order of JavaScript libraries if need be:
If you provide your own version of jQuery (i.e. if there's a <h:outputScript library="(whatever)" name="(whatever)/jQuery-(whatever).js" />
),
BootsFaces doesn't add its own jQuery. Its up to you to make sure your jQuery is compatible to BootsFaces. Our mechanism to detect whether you
add jQuery or not is fairly flexible. It checks whether the resource name contains the substring "jquery" and ends with ".js". Plus, it's case-agnostic.
The some applies to jQueryUI. In this case, we check for the sub-string "jquery-ui".
If you provide your own version of FontAwesome, BootsFaces doesn't load its own version of FontAwesome. We're looking for resource files containing the sub-string "font-awesome" or "fontawesome" and ending with ".css". Again, we ignore the case.
You can suppress Font Awesome on a per-page basis by adding the facet "no-fa" to the <h:head />
of your XHTML file.
web.xml
Alternatively, you can configure your web.xml
to suppress certain resources:
net.bootsfaces.get_fontawesome_from_cdn
to "yes" or "true" allows you to provide your own Font Awesome file.net.bootsfaces.get_datatable_from_cdn
to "yes" or "true" allows you to provide your own DataTables.js and dataTables.css
file. Also see the explanation in the section below.net.bootsfaces.get_jquery_from_cdn
to "yes" or "true" allows you to provide your own jQuery file.net.bootsfaces.get_jqueryui_from_cdn
to "yes" or "true" allows you to provide your own jQueryUI file.net.bootsfaces.get_bootstrap_from_cdn
to "yes" or "true" allows you to provide your own Bootstrap CSS file.
Note that this option is a bit difficult to get up and running. BootsFaces modifies the original Bootstrap files. That's only a handful of lines of code,
but be warned. Currently, we're aware of changes in these files:
There are many reasons to stray away from the way BootsFaces loads the JavaScript and CSS files of it's datatable.
In most cases, it's because of the firewall. Some time ago, we tried to improve both the memory footprint
and the UI performance of BootsFaces by dropping our own copy of the JavaScript and CSS resource files of <b:dataTable />
.
Since version 1.2.0, BootsFaces loads these file from a super-fast CDN. Before long, our friends from LiferayFaces informed us that
this is a no-go in many companies. The firewall doesn't allow to load JS files from outside.
So we follow the same approach you've already seen for jQuery above:
net.bootsfaces.get_datatable_from_cdn
to "yes" or "true" allows you to provide your own DataTables.js and dataTables.css
file. This means it's up to you to add these files in a <script>
or <h:outoutScript>
.<h:outputScript library="whatever" name="*datatables*.js />
and
<h:outputStylesheet name="*datatables*.css />
. If it finds something like this, it prevents the corresponding file to be loaded from the CDN.
BootsFaces even ignores the case to give you maximum flexibility.If you need to place your CSS or JS file before or after the other resource files, you can use the attribute position
of the
<h:outputStylesheet />
. This is a non-standard attribute, so chances are your IDE complains about it. If so, make it a pass-through attribute.