I have this problem:
- I use thymeleaf with layout plugin as main template engine. So I have 2-3 layouts with jquery default imported in header html element (because I use jquery everywhere).
- I use dandelion datatables only as extensions to make tables nice and useful.
- So, there is problem with duplicates jquery namespaces on pages with both, layout (default included jquery) and dandelion datatables (automatic include another jquery).
My idea is check if jquery is not already included in page when dandelion datatables (or dandelion assets) is used.
Do you understand my problem and idea? What do you think about it ? :)
Re: New dandelion resource management in thymeleaf
This post was updated on .
Actually, starting from the v0.10.0, there are two philosophies with regard to web resources (or assets) handling: either you let Dandelion handle all your assets globally in your project (1), or you just want to use Dandelion-Datatables and leave your legacy asset management untouched (2).
(1): Dandelion-Datatables v0.10.0 ships what we call "vendor bundles", i.e. asset bundles containing assets that point to CDNs. You have in particular one "jquery" bundle declared as a dependency of the "datatables" bundle.
Here follows the "jquery" and "datatables" bundles:
If the jQuery version you want to use matches with the one bundled inside Dandelion-Datatables, you have nothing to do. Dandelion will detect that DataTables needs jQuery to work and will load jQuery accordingly as defined in the above bundle (CDN, 1.11.0).
If you want to use another version or load the asset from another location, you can override the jquery asset by writing a custom bundle under your src/main/resources/dandelion folder and by using both the same asset name (jquery) and type (js).
For example: src/main/resources/dandelion/your-custom-bundle.json
In this case, you have to make sure that the jQuery version you want to use is compatible with the version of DataTables shipped in Dandelion-Datatables (1.9.4).
(2): If you want to use Dandelion-Datatables as a standalone library, i.e. without all the asset management brought by Dandelion, you can use the main.standalone property.
Just add main.standalone=true inside your src/main/resources/dandelion/datatables/datatables.properties file.
Under the hood, Dandelion will use the asset exclusion mechanism to exclude all assets that are marked as dependent of the "datatables" bundle.
That is to say only the DataTable's-related assets will be loaded and all other libraries will be your responsibility (jQuery, Bootstrap if your use the Bootstrap theme, ...).
Of course, all I said before will be documented but it's a good starting point if you wish to continue developing with the 0.10.0 ;-)