Dojo 1.10创建一个包含所需所有模块的.js文件

Dojo 1.10创建一个包含所需所有模块的.js文件,dojo,Dojo,我已经读了很多关于Dojo的新特性(1.6之后)。。。是否可以构建一个不仅包含dojo.js文件,而且还包含页面所需的所有模块(及其依赖项)的.js文件 谢谢。Dojo 1.x中的构建系统(包括AMD之前和之后的版本)支持构建层,它们完全满足您的要求。您使用应用程序需要的顶级模块配置层,然后构建过程将递归地扫描依赖项,以在一个模块中包含应用程序模块需要的所有内容 现代Dojo构建概要文件通常如下所示: var profile = { action: 'release', base

我已经读了很多关于Dojo的新特性(1.6之后)。。。是否可以构建一个不仅包含dojo.js文件,而且还包含页面所需的所有模块(及其依赖项)的.js文件


谢谢。

Dojo 1.x中的构建系统(包括AMD之前和之后的版本)支持构建层,它们完全满足您的要求。您使用应用程序需要的顶级模块配置层,然后构建过程将递归地扫描依赖项,以在一个模块中包含应用程序模块需要的所有内容

现代Dojo构建概要文件通常如下所示:

var profile = {
    action: 'release',
    basePath: 'src',
    releaseDir: '../dist',

    // Strip comments and newlines from CSS and flatten imports
    cssOptimize: 'comments',

    // Use the Closure compiler (which supports dead code removal)
    // for layer optimization; uglify is also a choice
    layerOptimize: 'closure',

    // Specify the packages the build should scan
    // (only include the ones you use; this follows the same format
    // as the AMD packages option if you need to specify paths)
    packages: [ 'dojo', 'dijit', 'dojox', 'app' ],

    // Layers should always be defined over existing modules.
    // You can define a layer over your own top-level application module,
    // or you can redefine dojo/dojo so that all of your code is
    // included as soon as you load dojo.js
    layers: {
        'dojo/dojo': {
            // This layer includes the loader
            boot: true,
            // When building dojo/dojo, don't bundle all of dojo/_base
            customBase: true,
            include: [ 'app/main' ]
        }
    }
};
简单应用程序的理想构建配置文件保证将所有内容构建到一个模块中,您最终只需在生产中加载以下内容:

  • 1个JS文件(dojo.JS)
  • 1个NLS文件(NLS捆绑包得到整合以匹配每个配置的层)
  • 1个CSS文件(由于使用
    cssOptimize
    导入扁平化)
  • 图像
额外资源:

  • Dojo构建教程:
  • 在生产中与Dojo和AMD合作:

谢谢。。。让我来试一试!