I need to load css when my module is loaded, so I did it like this using shims :
function loadCss(url) {
var link = document.createElement("link");
link.type = "text/css";
link.rel = "stylesheet";
link.href = url;
document.getElementsByTagName("head")[0].appendChild(link);
}
requirejs.config({ paths: paths, shim: {
'easyzoom': {
'deps': ['jquery'],
init: function () { loadCss('/lib/easyzoom/css/easyzoom.css'); }
}}
});
It works for other libraries like Datatables because they are non-Amd modules. But for Amd modules, requireJs doesn't look for shims so will not raise my init function.
Is there any way to have a callback called after a module is loaded ? Or load an Amd module as it was a plain javascript file to have shims looked for ?