2

I have a sample script which uses

dojo.require("dojo.parser");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.TabContainer");
dojo.require("dojox.grid.DataGrid");
dojo.require("dijit.Tree");
dojo.require("dojo.data.ItemFileReadStore");

I want to create a minified build of dojo, so I use this profile

dependencies = {
    stripConsole    : "normal",
    selectorEngine  : "acme",
    optimize        : "closure",
    layerOptimize   : "closure",
    cssOptimize     : "comments.keepLines",
    mini            : true,
    internStrings   : true,
    localeList      : "en-us",
    releaseName     : "dojo.custom",
    action          : "release",
    optimize        : "shrinksafe",
    layerOptimize   : "shrinksafe",

    layers : [
        {
            name         : "dojo.js",
            dependencies : [ 
                "dojo.parser",
                "dojo.data.ItemFileReadStore",
                "dojox.grid.DataGrid",
                "dijit.layout.BorderContainer",
                "dijit.layout.ContentPane",
                "dijit.layout.TabContainer",
                "dijit.Tree"
            ]
        }
    ],
    prefixes: [ [ "dijit", "../dijit" ], [ "dojox", "../dojox" ] ]
}

Yes, builder compile huge dojo.js file which I include in my html page, but still there is MANY xhr requests. System loads scripts which I don't use explicitly. Here's a screenshot

Danubian Sailor
  • 1
  • 38
  • 145
  • 223
Tommi
  • 3,199
  • 1
  • 24
  • 38
  • I see you are still using the 1.6 module system. Any particular reason for that? – hugomg Mar 02 '12 at 02:09
  • Actually, no any reason. I've download latest source (1.7.2) from offsite and created profile, following by samples in utils folder, and also by some tutorials on web. I really can't find a good explanation of build system in official docs. – Tommi Mar 02 '12 at 08:12
  • Its because the new version comes with the new AMD module system and loader. You probably should be using that instead (although admittedly the docs on the build system are still very confusing) – hugomg Mar 02 '12 at 12:49
  • Yes, and there is some (small, very small) samples in util/build/examples and one totally unclear tutorial about new build concept. Since I just can't figure it out, I've added all scripts to profile explicitly. It's poor scalable I think, however it works. Now this solution is acceptable, and I'll wait for info from developers or bloggers, who have some more brain than me; missingno, thanks for advance. – Tommi Mar 02 '12 at 13:34
  • Check my answer, I think that is probably your issue. – mtyson Mar 02 '12 at 20:08

1 Answers1

2

Interesting.

Are you sure the browser is successfully finding and loading the compressed version?

The browser is looking for _base.js which should definitely already be baked into that file.

Update

Tommi - dojo.js layer is always built by the build system, you don't have to explicitly declare it. I'm not sure what the effect will be of you explicitly declaring it along with dependencies. This might work, but it might not. Maybe the dependencies are overridding the normal dojo.js contents.

What I normally do is just let the system build dojo.js and then create a layer that has all the dijit/dojox stuff that I may want, and deploy that. I also usually create a 3rd separate file with my custom stuff in it.

I would try that. The key I think is to make a separate layer from dojo.js. (But still include the normal dojo.js in your page).

mtyson
  • 8,196
  • 16
  • 66
  • 106
  • Yes, builder creates dev version dojo.js.uncompressed.js, sizeof 1354 kb, and minified dojo.js, sizeof 485 kb. I can see in Chrome that dojo.js with proper size is loaded. – Tommi Mar 02 '12 at 08:16
  • Maybe I don't fully understand your approach, but if I create one layer dojo.custom.js with only necessary dependencies, and remove dojo.js layer at all, builder creates big dojo.js and dojo.custom.js, but browser fails to load it, because it missing /dojo/i18n.js and /dojo/parser.js. But I explicitly includes parser in custom layer, this is odd. I think I do something wrong, but can't figure out what exactly, so I will stay with my approach and maybe returns to it later. Thanks for wasting your time anyway :) – Tommi Mar 05 '12 at 08:22
  • 1
    The dojo.js that is default is the bare minimum for dojo core. You want to include that in your page. Then, create a layer with the OTHER stuff you want (widgets, classes, your stuff). Also include that. The way you are going with loading all the individual files is no bueno. – mtyson Mar 05 '12 at 16:49
  • Sorry, I not completely describe my actions. I included both dojo.js and my dojo.custom.js layers. – Tommi Mar 05 '12 at 20:07