[Dojo-interest] Take all of dojo and dijit out of a build layer

Ken Benjamin kenbenjamin at kenbenjamin.net
Sat Jun 14 15:11:42 EDT 2014


As Karl points out, it would be worth checking to see if all your
dependencies are indeed loading from the framework. If so, then go ahead
and exclude any dojo or dijit modules in your dependency tree.



However, if those dependencies aren’t yet loaded (just the paths specified
as you mention) then you SHOULD include them in your layer. The whole idea
of a layer is that it contains all of the needed parts to work as-is. I
think a dependency on dojo loader is fine. Having to rely on loading a
whole bunch of unbuilt, uncompressed dojo and dijit modules defeats the
purpose of a build so you might as well not build it at all.



I think you might want to try this layer structure, which is what I use for
my apps:



layers: {

       'dojo/dojo': {

            include: [],

            boot: true,

            customBase: false

                                },

        'app/main': {

            include: [ 'app/main']

        }

    }



This causes my app to build separately from dojo. Both layers get built but
everything I need for my app, aside from the dojo loader, is built in into
the top level ‘app/main.js’ and does not include the dojo loader. That
should work for your plugin / framework architecture.



So in my app/index.html I do something that ends up like this:



<script src="../dojo/dojo.js"></script>

<script src=”./main.js”></script>



Ken





*From:* fredfortier [via Dojo Toolkit] [mailto:
ml-node+s33424n4002706h91 at n3.nabble.com]
*Sent:* Saturday, June 14, 2014 8:42 PM
*To:* Ken Benjamin
*Subject:* Re: Take all of dojo and dijit out of a build layer



Yes, unfortunately, I do not have the opportunity to build an app from
scratch but rather on top of a (bloated) framework.



In a nutshell, I am creating a plugin (basically an app) for this
framework. A plugin is composed of a collection of amd modules. This
framework uses the dojo amd loader to load itself first... and then the
registered plugins. A plugin specifies a starting widget class and the
loader takes it from there.



This works well for development, but for production, I want to concatenate
all modules of my plugin in one file and uglify it. The layer feature of
the dojo build script does a surprisingly good job at traversing the amd
dependency tree to concatenate them in one file. But it also grabs the dojo
and dijit modules which I do not need at runtime because already loaded by
the framework.



I have quite a few modules, each of them has some reliance on dojo/dijit
modules. So it would have been nice to avoid the ceremony of specifying
each of them in the build file.



On Sat, Jun 14, 2014 at 2:17 PM, Ken Benjamin <[hidden email]
</user/SendEmail.jtp?type=node&node=4002706&i=0>> wrote:

Fred,

I'm pretty sure you're going to have to explicitly exclude every dojo and
dijit module from your myapp/app layer to get the effect you're after.

Is there some reason you want to build that way that you wish to share?
Maybe there's a better way to approach the problem.

In general, the idea is that you build all the parts, including the dojo and
dijit dependencies, you need for a given section of your app together in a
single layer for more efficient loading.

Ken B.



fredfortier wrote

> I am interested in building my app with two distinct layers.
>
> Specifically, I want to isolate all modules in the dojo and dijit packages
> in one layer.
>
> Here is what I have so far:
> layers: {
>             "myapp/deps": {
>                 include: ["dojo/dojo", "dijit/dijit"]
>             },
>             "myapp/app": {
>                 include: [ "myapp/main", "dgrid/OnDemandGrid" ],
>                 exclude: [ "myapp/deps" ]
>             }
>         }
>
> This still includes things like "dijit/Dialog" in my "myapp/app" layer. I
> suppose that I could include every single module of dojo and dijit that I
> am using by hand in my "myapp/deps" array. But is there a syntax that
> allows the equivalent of this: ["dojo/*", "dijit/*"]?




-----
Kenneth Benjamin
Web Application Architect for Hire

--
View this message in context:
http://dojo-toolkit.33424.n3.nabble.com/Take-all-of-dojo-and-dijit-out-of-a-build-layer-tp4002678p4002705.html

Sent from the Dojo Toolkit mailing list archive at Nabble.com.
--
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email] </user/SendEmail.jtp?type=node&node=4002706&i=1>
To unsubscribe, visit:
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest





-- 

Frédéric Fortier

Check out my professional profile and connect with me on LinkedIn.
http://lnkd.in/aM86Kf


-- 
Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email] </user/SendEmail.jtp?type=node&node=4002706&i=2>
To unsubscribe, visit:
http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest

------------------------------

*If you reply to this email, your message will be added to the discussion
below:*

http://dojo-toolkit.33424.n3.nabble.com/Take-all-of-dojo-and-dijit-out-of-a-build-layer-tp4002678p4002706.html

To unsubscribe from Take all of dojo and dijit out of a build layer, click
here
<http://dojo-toolkit.33424.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4002678&code=a2VuYmVuamFtaW5Aa2VuYmVuamFtaW4ubmV0fDQwMDI2Nzh8LTIxMDMyNDI5MDc=>
.
NAML
<http://dojo-toolkit.33424.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>




-----
Kenneth Benjamin 
Web Application Architect for Hire 

--
View this message in context: http://dojo-toolkit.33424.n3.nabble.com/Take-all-of-dojo-and-dijit-out-of-a-build-layer-tp4002678p4002709.html
Sent from the Dojo Toolkit mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.dojotoolkit.org/pipermail/dojo-interest/attachments/20140614/90a9c688/attachment-0001.htm 


More information about the Dojo-interest mailing list