Is there a way to create a Dojo module that includes one file from the package location?

I have the following build profile for a small application:

var profile = (function(){ var copyOnly = function(filename, mid){ /* ..snip.. */ }; return { basePath: "../../src", releaseDir: "../dist", releaseName: "lib", action: "release", packages: [ 'dojo', 'dijit', //'dojox', 'amd', { name: 'lodash', location: 'lodash', trees: [ [".", ".", /(\/\.)|(~$)|(vendor|test)/] ] }, { name: 'd3', location: 'd3', main: 'd3.min', trees: [ [".", ".", /(\/\.)|(~$)|(src|lib|test)/] ] }, { name: 'app', location: 'app' } ], layers: { "dojo/dojo": { include: [ "dojo/dojo", "amd/d3","amd/gmaps", "app/main", "app/run" ], customBase: true, boot: true } }, resourceTags: { /* ..snip.. */ } }; })(); 

The problem is this: all I need is the lodash.min.js file, which will be processed by the Dojo build system. Unfortunately, when you include the package definition in your profile, the build system scans all the files in the corresponding directory using the implicit value of trees . You can rewrite it (as I did here) and add some ignore directives, but it is ugly and leaves you open so that something is missing. What I would like to do is to affirmatively indicate which file (s) I am interested in processing for my build process.

Does Dojo let you do this? The documentation is a bit sparse in this area, but if you can help me find a resource that will explain this more clearly, it will be great!

+6
source share
1 answer

At least in 1.9, I believe this can be done:

 // ... snip ... { name:'lodash', location:'lodash', trees:[], dirs:[], files:[ ["lodash.min.js"] ] }, 

This explicitly lists the files, and also compresses implicit tree and directory detection.

My belief here is based on a quick overview of util/build/discover.js - but since I read the documentation files , it should be supported.

+1
source

All Articles