0
我的资产(尤其是图像)的开发路径与生产(我将使用CDN)的开发路径非常不同。 我写了一个这样的帮手:Ember.js图像路径
Ember.Handlebars.registerBoundHelper("relative-path", function(filePath) {
return App.get("assetsStartPath") + filePath
});
这个辅助工作得很好,我只需要设置“assetsStartPath”中创建应用程序。
var App = Ember.Application.create({
assetsStartPath: "http://0.0.0.0:5000/my_static_path/",
// in production will be for example "http://myapp.mycnd.com/foo/bar/img/"
...
});
而且在我的模板
{{relative-path "img/some_image.png"}}
的问题是,我想使用这个助手里面bind-attr
,就像这样:
<imd {{bind-attr src="relative-path 'img/some_image.png'"}} />
Obviuosly这不起作用。 我如何获得我想要的结果? 任何建议,欢迎