1

我正在为 Dojo 1.8 构建系统而苦苦挣扎。我正在尝试使用 dojo/text!templates/SomeView.html 从 url myapp/tmpl/SomeView.html 获取 html:

//FILE: SomeView.js
define(["dojo/_base/declare", "dojo/text!templates/SomeView.html", ...
  function(declare, SomeViewTemplateHTML, ...
  return {...

我似乎无法检测到映射到“myapp/tmpl/”模块路径的“模板”前缀。我尝试过路径、loaderConfig.paths、前缀。但是当我运行 build.sh --profile app.profile.js 时,这些似乎都没有做任何事情:

//FILE: app.profile.js
var profile = (function(){
return {
    basePath: ".",
    releaseDir: "builds",
    releaseName: "foooo",
    optimize: "closure",
    cssOptimize: "comments",
    action: "release",

    packages:[{
        name: "pkg1",
        location: "myapp/pkg1"
    }],

    loaderConfig: {
        paths: {
        "templates": "myapp/tmpl"
        },
        prefixes: {
        "templates": "myapp/tmpl"
        }               
    },
    prefixes: {
        "templates": "myapp/tmpl"
    },


    layers: {
        "dojo/dojo-release": {
            include: [ "dojo/dojo", "dojo/domReady"],
            customBase: true,
            boot: true
        },
        "foobar/foobar-release": {
            include: [
                "myapp/app"
            ]
        }
    }
};
})();

任何帮助将不胜感激!我已经多次阅读 dojo/app 和 dojo 构建页面,但所有信息确实有限......

问候,肯

4

1 回答 1

0

没有模板映射作为构建过程的一部分,所以如果以下是您的结构

myapp/SomeView.js
myapp/tmpl/SomeView.html

那么dojo/text!templates/SomeView.html应该是dojo/text!./tmpl/SomeView.html

于 2012-12-11T17:04:04.760 回答