less/less.js — pull request #2233 by levithomason (2014-10-16 04:36:17+00:00)
Title: Register Stylesheets Promise Method

**Problem**
As web apps become more dynamic developers are now finding they have the need to load/unload stylesheets dynamically. Currently, less does one initial scan for stylesheets on load. This means less will not parse stylesheets added dynamically after page load, even when calling `less.refresh()` or `less.modifyVars()`.

**Proposed Solution**
Make the stylesheet loading code available as a method, returning a promise. On resolve, you can `.then()` call a `less.refresh()` or `less.modifyVars()`:

```javascript
less.registerStylesheets().then(
function () {
less.modifyVars(record);
}
);
```