I was thinking of something to call the JQuery plugins, I would call all the plugins on a single page, but loading them only if they are used.
For example:
On page X I use DataTables, then:
if($(".dataTable") != undefined){ //se a página usar o dataTable
if($.dataTable == undefined){ //e se ele não foi carregado
//carregaria os arquivos necessários
$.getScript("dataTable.min.js", function(){
$(".dataTable").dataTable(); //e então incluiria a chamada
});
}
}
This would be done for all the plugins used throughout the system. That way, only the plugins used on the page would be loaded, and you would not have to include the files and the page-by-page call.
My questions are:
- Would this be feasible?
- Is there any way I can do something similar?
The language used is PHP.
I'm actually using the following Dashboard: link , it provides several interesting plugins, I'd like to call them all available but that would be VERY heavy to load, and loading them only on the pages they were used on would be a work (besides being horrible for maintenance).