help desk
This is related to Extenso, how to add JS/CSS resources with the new page template.
We have created a new page template called page_v3 to optimize the speed of pages, to reduce server calls we have merged most of the CSS and JS into one file respectively, we also thought of a way to add files specific to the site into those, I will explain how with an example of if you need to include the plugin chosen.js into a site.
chosen.js is included in the require.js alias definition of the template, so you can call it already in widgets that are in pages with that template (and lastest sed_site module).
require example in your widget javascript :
This will include the chosen.js script only in pages that have your widget, there are no "require" asynchronous module loader for the chosen CSS, thus you need to include it in sed_site_css only for your site by following these steps :
require(["chosen"], function() { var config = { '.chosen-select' : {}, '.chosen-select-deselect' : { allow_single_deselect: true }, '.chosen-select-no-single' : { disable_search_threshold: 10 }, '.chosen-select-no-results': { no_results_text: '' }, '.chosen-select-rtl' : { rtl: true }, '.chosen-select-width' : { width: '100%' } } for (var selector in config) { $(selector).chosen(config[selector]); } });
Replied on: 2021-03-08 09:07:00