[Dojo-interest] Layered Build

Андрей Бердников tsofistgudmen at gmail.com
Sat Feb 13 06:16:48 EST 2016


Example:

Profile:

return {
    useSourceMaps:     false,
    basePath:          BASE_PATH,
    releaseDir:        "../",
    releaseName:       RELEASE_NAME,
    action:            "release",
    layerOptimize:     "closure",
    optimize:          "closure",
    cssOptimize:       "comments",
    mini:              true,
    stripConsole:      "warn",
    internStrings:     true,
    packages:          [
        {
            name:     "dojo",
            location: "dojo"
        },
        {
            name:     "dijit",
            location: "dijit"
        },
        {
            name:     "core",
            location: "../../core"
        }
    ],
    layers:            {
        "dojo/dojo":                       {
            include:        [
                "dojo/dojo",
                "dojo/main",
                "dojo/_base/loader",
                //...
                "dojo/html",
                "dojo/touch",
                "dojo/colors"
            ],
            boot:           true,
            includeLocales: ["en-us", "ru"]
        },
        "dijit/dijit":                     {
            include:        [
                "dijit/dijit",
                "dijit/main",
                //...
                "dijit/TooltipDialog",
                "dijit/Dialog"
            ],
            includeLocales: ["en-us", "ru"]
        },
        "dijit/dijit-tree":                {
            include:        [
                "dijit/Tree",
                "dijit/tree/ObjectStoreModel",
                "dijit/tree/dndSource"
            ],
            exclude:        [
                "dojo/dojo",
                "dijit/dijit"
            ],
            includeLocales: ["en-us", "ru"]
        },
        "core/core-base":                  {
            copyright: COPYRIGHT,
            include:   [
                "core/main",
                "core/lang",
                //...
                "core/util/math",
                "core/encoding",
                "core/encoding/base64"
            ]
        },
        "core/core-main":                  {
            copyright: COPYRIGHT,
            include:   [
                "core/util/string/diff",
                "core/util/promisify",
                "core/util/uuid"
                //...
            ],
            exclude:   [
                "core/core-base"
            ]
        }
    }
};


Usage in app:

<script src="/libs/dojo/dojo.js"></script>
<script>
    require(["dijit/dijit", "dijit/dijit-tree", "core/core-base",
"core/core-main"], function() {
        require(["core/lang"], function(lang) {
            // do some with lang#
        });
    });
</script>

2016-02-13 14:08 GMT+03:00 Андрей Бердников <tsofistgudmen at gmail.com>:

> Hello!
> A long time ago I too was faced with such difficulties, but I was able to
> understand.
> I recommend you to organize the following layers: dojo/dojo, dijit/dijit,
> dojox/dojox, de/myapp
> Each layer always includes all dependencies said modules, while files can
> be deleted from the other layers. Therefore, if you are certain that in the
> layer dijit you do not need the files from the dojo layer select it in the
> exceptions.
> Similarly, the same should be done with de-myapp: eliminate layers
> dojo/dojo, ditij/dijit etc.
>
> Sorry my English..
>
> 2016-02-11 23:56 GMT+03:00 Klausen Schaefersinho <
> klaus.schaefers at gmail.com>:
>
>> Hi,
>>
>> sorry for the empty last mail... So I am trying to create a layered
>> build. I have one profile file for a bootable dojo distribution that
>> contains only the needed files. Now I tried to do a compresses file for my
>> app. The profile file looks like:
>>
>>
>> var profile = {
>>
>> basePath: "./",
>>
>>     releaseDir: "./release2",
>>
>>     hasReport: true,
>>
>>     cssOptimize: 'comments',
>>
>>     mini: true,
>>
>> action : "release",
>>
>>
>> stripConsole: 'all',
>>
>> //layerOptimize: 'closure',
>>
>>
>> selectorEngine: 'lite',
>>
>>
>>
>>     packages:[
>>
>>         {
>>
>>             name: "dojo",
>>
>>             location: "../lib/dojo/dojo"
>>
>>         },
>>
>>         {
>>
>>             name: "dijit",
>>
>>             location: "../lib/dojo/dijit"
>>
>>         },
>>
>>         {
>>
>>             name: "dojox",
>>
>>             location: "../lib/dojo/dojox"
>>
>>         },{
>>
>>             name: "de",
>>
>>             location: "/de"
>>
>>         }
>>
>>     ],
>>
>>
>>
>>     layers: {
>>
>> "de/myapp": {
>>
>>             include: [
>>
>>                   "de/myappp/App"
>>
>>           ],
>>
>>           exlcude : [
>>
>>                   "dojo/main",
>>
>>                 "dojo/_base/browser",
>>
>>                 "dojo/_base/loader",
>>
>>                 "dojo/_base/lang",
>>
>>                 "dojo/dom-class",
>>
>>                 "dojo/dom-construct",
>>
>>                 "dojo/dom-style",
>>
>>                 "dojo/store/Memory",
>>
>>                 "dojo/_base/Color",
>>
>>                 "dojo/_base/NodeList",
>>
>>                 "dojo/cookie",
>>
>>                 "dojo/query",
>>
>>                 "dojo/window",
>>
>>                 "dojo/dom-style",
>>
>>                 "dojo/_base/window",
>>
>>                 "dojo/dom",
>>
>>                 "dojo/touch",
>>
>>                 "dojo/query",
>>
>>                 "dojo/_base/declare",
>>
>>                 "dojo/_base/event",
>>
>>                 "dojo/_base/lang",
>>
>>                 "dojo/request/xhr",
>>
>>                 "dojo/json",
>>
>>                 "dojo/on",
>>
>>                 "dojo/has",
>>
>>                 "dojo/dom",
>>
>>                 "dojo/topic",
>>
>>                 "dojo/aspect",
>>
>>                 "dojo/io-query",
>>
>>                 "dojo/hash",
>>
>>                 "dojo/dom-attr",
>>
>>                 "dojo/request/xhr",
>>
>>                 "dojo/request",
>>
>>                 "dojo/_base/window",
>>
>>                 "dojo/dom-class",
>>
>>                 "dojo/parser",
>>
>>
>>
>>
>>
>>                 "dijit/_Widget",
>>
>>                 "dijit/_Templated",
>>
>>                 "dijit/registry",
>>
>>
>>
>>                 "dojox/dtl",
>>
>>                 "dojox/dtl/Context"
>>
>>           ]
>>
>>     }
>>
>>    }
>>
>> };
>>
>>
>> I exclude all the dojo libs, as I have them already in the compressed
>> dojo_app.js file. In my html in load the layers like:
>>
>>   <script src="/libs/dojo/dojo_app.js"></script>
>>
>>   <script src="/libs/myapp/app.js"></script>
>>
>> However this does not work. I am not sure why this is an issue. Can
>> anybody give me a hint. I would prefer to have one core dojo compressed.js
>> and several app.js files so I can optimize the loading...
>>
>>
>> Cheers,
>>
>>
>> Klaus
>>
>>
>> --
>> “Overfitting” is not about an excessive amount of physical exercise...
>>
>> --
>> Dojo Toolkit: http://dojotoolkit.org/
>> Tutorials: http://dojotoolkit.org/documentation/
>>
>> Dojo-interest at mail.dojotoolkit.org
>> To unsubscribe, visit:
>> http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20160213/c3f438e0/attachment.htm 


More information about the Dojo-interest mailing list