Building Declaratively

There is a specific transform that is part of the Dojo Builder that can be used to scan your application code for dependencies. The build profile in this demo (parserAutoRequire.profile.js) is designed to allow you to build all the declarative application dependecies into a single layer. It tags the html resources as declarative which means they will be parsed for auto-requirement and declarative requirement dependencies. It also then flags a layer as the layer where those dependencies will be included (declarativeIncludes: true):

var profile = {    
    /* Other Build Profile Configuration */

    layers: {
		"dojo/dojo": {
			include: [ "dojo/dojo" ],
			customBase: true,
			boot: true
		},
		"parserAutoRequire/src": {
			include: [],
			declarativeIncludes: true
		}
	},

	resourceTags: {
		declarative: function(filename){
			return /\.htm(l)?$/.test(filename);
		},
		amd: function(filename, mid){
			return /\.js$/.test(filename);
		}
	}
};