Search code examples
javascriptasp.net-mvcdojorequire

Dojo modules in bundle


Is there a way to add Dojo modules in ASP.NET MVC bundle? I know that for using Dojo modules, should use define() or require() and browser loads each module as different .js file. But in pages, where I need to use more modules and browser should load 50 (for example) .js files, this make entire page's load slower.

Thank you!


Solution

  • As far as I know there is no direct way to make a dojo build in an ASP.NET MVC bundle.

    But in order to maximize page's load you need to build your dojo application using dojo/util and link the resulted files in your HTML head.

    A dojo build allows you to:

    • Concatenate your modules, so you could send to the client all your code in few js files.
    • Minify the source code, which make the code lighter to download (dojo build use Closure Compiper or Shrinksafe).

    More information on The Dojo Build System.

    Very useful dojo boilerplate to start with.