wmakley
wmakley

Reputation: 1272

Can't figure out dojo build system at all, minimal working example?

Maybe I'm just stupid, but I can't understand this article at all: https://dojotoolkit.org/documentation/tutorials/1.10/build/

Is there a working example or better article anywhere? I am to the point of googling other RequireJS-based build tools with better instructions. I was able to get r.js going in about 15 minutes, but it doesn't seem to work with dojo.

My project has the following file structure:

I just want to concatenate main.js, everything in app, and any dojo modules I am using into a single file. Shouldn't be too difficult! But it just copies every JS file in the release folder, and that's it. It doesn't seem to concatenate anything.

Here is my app.profile.js:

var profile = (function(){
    var copyOnly = function(filename, mid) {
            var list = {
                "./app.profile": true,
                "./package.json": true
            };
            return (mid in list) ||
                /^\.\/lib\//.test(filename) ||
                /(png|jpg|jpeg|gif|tiff|html)$/.test(filename);
        };


    return {
        basePath: "./",
        releaseDir: "./build",
        releaseName: "prod",
        action: "release",
        layerOptimize: "closure",
        optimize: "closure",
        cssOptimize: "comments",
        mini: true,
        stripConsole: "warn",
        selectorEngine: "lite",

        packages:[{
            name: "dojo",
            location: "dojo"
        },{
            name: "dijit",
            location: "dijit"
        },{
            name: "dojox",
            location: "dojox"
        },{
            name: "app",
            location: "app"
        }],

        layers: {
            "dojo/dojo": {
                include: [ "dojo/dojo", "main" ],
                customBase: true,
                boot: true
            }
        },

        resourceTags: {
            copyOnly: function(filename, mid) {
                return copyOnly(filename, mid);
            },
            amd: function(filename, mid) {
                return !copyOnly(filename, mid) &&
                        /\.js$/.test(filename);
            }
        }
    };
})();

Upvotes: 1

Views: 574

Answers (1)

paulsm4
paulsm4

Reputation: 121669

I'm not sure what your specific problem/question is, but I have two suggestions:

  1. Here are some other (perhaps more understandable) tutorials:

  2. Google for "Dojo" "ShrinkSafe"

Upvotes: -1

Related Questions