LMD JavaScript config

azproduction edited this page Mar 13, 2013 · 1 revision

Start from LMD 1.10.6 you can write lmd config using JavaScript.

.lmd.js module MUST exports .lmd.json format

Instead of doing this

{
    "name": ".lmd.json example",

    "root": "../js",
    "output": "../index.lmd.js",
    "www_root": "../",
    "modules": {
        "main": "main.js",
        "dep": "dep.js"
    },
    "main": "main",
    "ie": false
}

You can write JavaScript file

var projectRoot = "../js";

var inPackageModules = {
    main: "main.js",
    dep: "dep.js"
};

module.exports = {
    name: ".lmd.js example, you dynamically define config files",
    description: "Write JS instead of JSON!",

    root: projectRoot,
    output: "../index.lmd.js",
    www_root: "../",
    modules: inPackageModules,
    main: "main",
    ie: false
};

See LMD config for config format. See demo, code