less.js: How to trigger sync and async imports
How does less decide to call loadFile or loadFileSync of the current fileManager? According to this code it requires an isSync-parameter to be set. But a short search for a call to getFileManager reveals that this option is only used by lib/less/functions/data-uri.js.
Is it possible to set this option explicitly when calling render()?
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 27 (18 by maintainers)
Is there a
renderSyncyet? If not, is there a workaround for a synchronousrender?Edit: Nvm. For any future person who stumbles upon this, this is what I did:
Cool!
There is just one problem: It is very unusual to do something synchronously while accepting a
callback(as therender-function does). You’re suggesting async-option like this:?
Imho it’s weird to have the callback being called synchronously. I’d expect an api like this:
As of now, adding
syncImport: trueto my options fixed this for me.(It’s not in the documentation… I was just lucky enough to stumble across it in the source code)