Dojo 1.8构建系统 - 如何设置前缀/路径?

时间:2012-12-11 09:51:49

标签: build dojo path prefixes

我正在努力使用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构建页面,但所有信息都非常有限......

此致 肯

1 个答案:

答案 0 :(得分:0)

构建过程中没有模板映射,因此如果以下是您的结构

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

然后dojo/text!templates/SomeView.html应为dojo/text!./tmpl/SomeView.html