Skip to content
azproduction edited this page Jan 28, 2013 · 1 revision
  • Flag shortcuts

You can define flag shortcuts: true to enable shortcuts in LMD package. Then you can use short names instead of full paths. Symbol @ indicates that module content is shortcut.

{
    "modules": {
        "some-json": "@/path/to/file.json",
        "jquery": "@http://yandex.st/jquery/1.7.1/jquery.min.js",
    }
}
// old way...
require.async("/path/to/file.json", function () {});

// its the same as above, but much abstract and short
require.async("some-json", function (data) {
    console.log('data');
});

require.js("jquery", function () {
    require('$').ready(function () {
        // do your stuff
    });
});
Clone this wiki locally