2012-06-01 35 views
3

试图找出为什么我无法在我的dojo构建中实习字符串。我的图层文件被正确创建,但与每个单独的dijits相关的代码没有正确执行。自定义Dojo构建字符串的问题

这里是一块构建输出的一部分,说明它失败:

release: Interning strings for : ../../release/fwijits5.31.2012/content/fwijits/optionalDijits/commenting.js 
release:  ../../release/fwijits5.31.2012/content/fwijits/optionalDijits/templates/commenting.htm 
release: Optimizing (shrinksafe, stripConsole=normal) file: ../../release/fwijits5.31.2012/content/fwijits/optionalDijits/commenting.js 
release: Could not strip comments for file: ../../release/fwijits5.31.2012/content/fwijits/optionalDijits/commenting.js, 

error: InternalError: illegal character

它看起来因为模板没有得到正确添加到js文件,如优化失败。这是js在html被实现后的样子。你不能从输出中看出来,但是在javascript的末尾会加上一些特殊字符。

if(!dojo._hasResource["fwijits.optionalDijits.commenting"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. 
dojo._hasResource["fwijits.optionalDijits.commenting"] = true; 
dojo.provide("fwijits.optionalDijits.commenting"); 

dojo.require("dijit._Widget"); 
dojo.require("dijit._Templated"); 

dojo.require("dijit.layout.ContentPane"); 
dojo.require("dijit.layout.TabContainer"); 


//The main widget that gets returned to the browser 
dojo.declare("fwijits.optionalDijits.commenting", [dijit.layout.ContentPane, dijit._Templated], { 

    widgetsInTemplate: true, 
    _earlyTemplatedStartup: true, 
    templateString: dojo.cache("fwijits.optionalDijits", "templates/commenting.htm"), 
    basePath: dojo.moduleUrl("fwijits.optionalDijits"), 

    //This function contains all configurable parameters 
    constructor: function(params){ 
    params = params ||{}; 
    this.inherited(arguments); 
    }, 

    //This functions run on a "startup" call 
    startup: function(){ 
    var _this = this; 

    this.inherited(arguments); 
    }, 

    _addPointComment:function(){ 
    console.debug("button clicked"); 
    } 

}); 

} 

该htm文件非常简单,所以我不认为这是我的问题的根源。

<div dojoAttachPoint="containerNode"> 
    <div dojoattachpoint="_outerDiv"> 
    <div dojoattachpoint="_addPoint" dojotype="dijit.form.Button" dojoattachevent="onClick:_addPointComment"><b>Add Comment</b></div> 
    </div> 
</div> 

有什么建议吗?

+0

您确定它与templateString的实习有关吗?如果将dojo.cache语句替换为“

foo
”,会发生什么情况? – Frode

+0

你说得对,即使我替换了dojo.cache语句,我仍然得到错误。任何想法可能是什么问题? – wrdaigle

+0

不,很难分辨。你绝对确定你的commenting.js没有任何奇怪的隐形角色?如果您禁用注释剥离或其他一些优化,它是否也会发生? – Frode

回答

0

哪个版本的Dojo?构建系统中存在一个错误,使用不以HTML或HTM结尾的实习字符串,尽管我从未尝试过使用HTM来确认。

可能值得一检查。我知道这是1.7固定的,回到1.8。

https://bugs.dojotoolkit.org/ticket/15867