【问题标题】:Dojo requesting already inlined Dijit templates --Google Closure buildDojo 请求已内联的 Dijit 模板 --Google Closure build
【发布时间】:2013-06-12 16:37:15
【问题描述】:

我已经在 StackOverflow 上询问过this questionsolution 应该已经在提交中进行了修补:

但即使在使用此设置进行了一些广泛的测试之后:

  • Dojo / DojoX / Dijit 1.8.3
  • 在最新版本中使用(GitHub 上的主分支)

我一直遇到同样的问题。

问题如下:

使用 util build.sh 脚本构建我的应用程序后。 我的个人资料是:

var profile = {
    basePath: '../src/',
    action: 'release',
    cssOptimize: 'comments',
    mini: true,
    internStrings: true,
    optimize: 'closure',
    layerOptimize: 'closure',
    stripConsole: 'none',
    selectorEngine: 'acme',
    layers: {
        'dojo/dojo': {
            include: [ 'dojo/dojo', 'dojo/i18n', 'dojo/domReady', 'app/main', 'app/run', 'app/widgets/Application'],
            boot: true,
            customBase: true
        },
    },
    staticHasFeatures: {
        'dojo-trace-api': 0,
        'dojo-log-api': 0,
        'dojo-publish-privates': 0,
        'dojo-sync-loader': 0,
        'dojo-xhr-factory': 0,
        'dojo-test-sniff': 0
    }
};

并运行:

java -Xms256m -Xmx256m  -cp ../shrinksafe/js.jar:../closureCompiler/compiler.jar:../shrinksafe/shrinksafe.jar org.mozilla.javascript.tools.shell.Main  ../../dojo/dojo.js baseUrl=../../dojo load=build --require "$myConfig" --profile "$myProfile" --releaseDir "$myReleaseDir" $@
  • 1) 我的 Dijit 模板按照应有的方式内联在输出文件中,但是在运行应用程序时,Dojo 仍在为已经内联的模板发出 Ajax 请求!

  • 2*) nls 目录放置在错误的目录中(dojo 目录代替了根目录)并且必须移动。 (我不确定这是否与我遇到的错误有关。)

内联格式为:

"url:path/to/my/template.html":'<p>Some escaped HTML</p>'

模板要求格式:

dojo/text!./path/to/my/template.html

提前致谢!

【问题讨论】:

    标签: dojo template-engine google-closure-compiler dojo-build


    【解决方案1】:

    我也有类似的问题。在我的应用程序中,我使用了多个 dijit 小部件,为了避免许多 AJAX 调用,我创建了一个层。

    layers:{
    'dijit/mydijit':{
        include:["dijit/_base","many dijit widgets"]
    }
    

    在我的应用程序中包含dijit/mydijit.js 后,浏览器继续对dijit/_base 进行AJAX 调用

    为了解决这个问题,我添加了dijit/_base 作为dijit/mydijit 层的依赖项

    layers:{
    'dijit/mydijit':{
        include:["dijit/_base","many dijit widgets"],
        dependecies:["dijit/_base"]
    }
    

    在此之后没有dijit/_base.的请求

    希望对你有帮助:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多