Skip to content

cloudcmd/loadremote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Load Remote

Library for loading modules from cdn or local file system.

Install

bower i loadremote --save

How to use?

You should create files modules.json similar to this:

[{
    "name": "socket",
    "version": "1.3.5",
    "local": "/socket.io/socket.io.js",
    "remote": "//cdn.socket.io/socket.io-{{ version }}.js"
}]

And options.js:

{
    "online": true
}

Then load execon and lib/load-remote.js and run this code:

loadRemote('socket', {  /* name of module in modules.json */
    name : 'io',    {   /* name of variable in window object */
    prefix: prefix,     /* prefix for loading modules.json and options.json (could be empty) */
    noPrefix: true      /* do not add prefix to socket local url */
}, callback);

License

MIT