Login Register

Going dev to build with less pain

Just a little tidbit I figured out today when I had to create a custom build. Rather than creating a custom profile that has all your dependencies, create a file in src that has the dependencies and then point your profile to that file. It makes things a whole lot easier. You like examples? I thought so. Setup src/myApp/MyApp.js
// so dojo knows where to look for myApp requires
dojo.setModulePrefix('myApp', 'src/myApp');

dojo.require('dojo.lang');
dojo.require('dojo.io.*');
dojo.require('dojo.html');
dojo.require('myApp.foo');
dojo.require('myApp.bar');

// this is the bit that was required
dojo.provide('dojo.myApp.MyApp');
And then buildscripts/profiles/myApp.profile.js:
var dependencies = [
  'dojo.myApp.MyApp'
];

dependencies.prefixes = [
  ['myApp', 'src/myApp']
];

load('getDependencyList.js');
Now, when you are developing, you just dojo.require("dojo.myApp.MyApp") and pull in everything through that. Notice that this file lives in the dojo src. That way, you don't have to setup the extra module prefix ahead of time; rather you can just pull in the one file which does all the setup for you.