Revised the code https://github.com/less/less.js/blob/3.x/dist/less.js#L750
Try:
// Я подгружал по клику. //document.getElementById("clicker").addEventListener("click", function() { var link = document.createElement("link"); link.setAttribute("rel", "stylesheet/less"); link.setAttribute("href", "/2.less"); document.getElementsByTagName("head")[0].appendChild(link); // Сверху эквивалент //$('head').prepend('<link type="text/css" rel="stylesheet/less" href="another.less">'); less.registerStylesheetsImmediately(); less.refresh(true, undefined ,true); //});
Possible without adding an element to the head . But not the fact that when updating the library it will not stop working.
var link = document.createElement("link"); link.setAttribute("href", "/2.less"); less.sheets.push(link); less.refresh(true, undefined ,true);