compy
compy copied to clipboard
async require
Right now everything is built in single js file, which is awesome since removes require.js complexity. Though it is reasonable that in certain cases some sources we need to load asynchronously. And there are cases where we need to load script from 3rdpaty server (to use API for example)
problem
- Compiler actually adds/wraps all js resources in single file. There is no way to explain what resource should be loaded and what not.
- We have no way to block js execution while requiring
solutions
- we can put comment in the beginning of file
// async
and customize compiller/or pattern matcher in grunt 2) build some kind of api to do that, I would say:
var asyncRequire = require('async-require');
asyncRequire(['../module_name.js', function(moduleName){
execute
}])
:+1: