-
Notifications
You must be signed in to change notification settings - Fork 27
Supported modules
Mikhail Davydov edited this page Dec 17, 2013
·
5 revisions
By default LMD supports all these modules
Default module type for LMD.
// @globals require module exports
// CommonJS Module exports
// or exports.feature = function () {}
module.exports = function(message) {
return message.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
};
This format of module is deprecated. Use CommonJS/Modules instead.
function main(require) {
var print = require('depA'),
i18n = require('i18n'),
$ = require('$'); // grab module from globals: LMD version 1.2.0
var text = i18n.hello + ', lmd';
print(text);
$(function () {
$('#log').text(text);
});
}
This format of module is deprecated. Use CommonJS/Modules instead.
(function (require/*, exports, module*/) {
var escape = require('depB');
return function(message) {
console.log(escape(message));
}
})
Note:
- CommonJS module will be wrapped by builder
(function (require, exports, module) {\n%code%\n})
- you can require CommonJS off-package modules by declaring one of flags
async_plain
orasync_plainonly
For config, i18n and other resources
{
"hello": "Привет"
}
For templates
<i class="b-template">${content}</i>
See Shortcuts
See AMD modules