4

I have a dojo build profile that builds two layers- one layer dojo/dojo layer and another layer for my app files.

This all works fine and results in two "big" files (main.js and dojo.js) which contains all the required code.

However, I don't really want to build the "dojo/dojo" layer all the time when building the app, it's taking a long time (>100 seconds) and since that layer doesn't really change dramatically I don't want to keep building it.

The problem is that even with just one layer "app/main" the build is still creating all the dojo/dijit/dojox files and still taking a long time (I know I don't need those files but it's still parsing/optimizing/compressing... all these files).

Is there anyway to avoid this? I just want a simple small build of just my application files.

here is my profile:

var profile = (function () {
    var dojoDeps = ['dojo/dom', 'dojo/i18n', 'dojo/domReady', 'dojo/parser'];
    var dojoxDeps = ['dojox/grid/DataGrid', 'dojox/data/JsonRestStore'];
    var dijitDeps = ['dijit/form/Form', 'dijit/form/ValidationTextBox', 'dijit/form/Button',
             'dijit/layout/BorderContainer'];

    var allDojoDeps = [].concat(dojoDeps, dojoxDeps, dijitDeps);
    var appDeps = ['app/main', 'app/run'];

    return {
    basePath: '../../../../dojo/dojo-src',
    releaseDir: "../../target/dojo-compiled",
    releaseName: "",
    action: 'release',

    cssOptimize: 'comments',
    mini: true,
    optimize: 'closure',
    layerOptimize: 'closure',

    stripConsole: 'normal',
    selectorEngine: 'lite',

    layers: {
        'dojo/dojo': {
        include: allDojoDeps,
        boot: true
        },
        'app/main': {
        include: appDeps,
        exclude: allDojoDeps
        }
    },

    staticHasFeatures: {
        'dojo-trace-api': 0,
        'dojo-log-api': 0,
        'dojo-publish-privates': 0,
        'dojo-sync-loader': 0,
        'dojo-test-sniff': 0
    },

    packages: [
        {
        name: "dojo",
        location: "dojo"
        },
        {
        name: "dijit",
        location: "dijit"
        },
        {
        name: "dojox",
        location: "dojox"
        },
        {
        name: "app",
        depsScan:false,
        location: "../../src/main/webapp/app"
        }
    ]
    };

})();

Packages.com.google.javascript.jscomp.Compiler.setLoggingLevel(Packages.java.util.logging.Level.WARNING);
Web Devie
  • 1,207
  • 1
  • 13
  • 30

1 Answers1

0

optimize: "closure" will cause the optimizer to be run for all files in the release. the layerOptimize option is what controls the optimization for layers so you can set optimize: "" to stop optimizing non-layer files and you should find that your build runs significantly faster.

neonstalwart
  • 760
  • 3
  • 12
  • Thanks a lot! it did reduce the time from ~160 to ~80-90. However I still think it should be able to run a lot quicker - my entire webapp directory is 48 files taking about 61KB, relativity small. – user2133807 Oct 02 '13 at 15:11