[英]Meteor: inject html into client-side file on startup
Using the SSR and inject initial packages, I currently have the following server-side code: 使用SSR并注入初始程序包,我目前有以下服务器端代码:
Meteor.startup(function() {
.....
Inject.rawHead('importList', function(imports) {
return imports = Blaze.toHTML(Template.imports);
});
});
This injects a list of html imports into the head, and works perfectly. 这会将html导入列表注入到头部,并且效果很好。
I'd like to modify the function so that the code is injected into /client/imports.html
instead of into the head... can this be done? 我想修改该函数,以便将代码注入到
/client/imports.html
而不是注入到头部中……可以这样做吗?
Looks close to this solution . 看起来很接近这个解决方案 。 Try this in the
client
folder of Meteor or use if(Meteor.isClient)
for compactness: 在Meteor的
client
文件夹中尝试此操作,或使用if(Meteor.isClient)
进行if(Meteor.isClient)
:
Inject.rawHead('importList', function(imports){
return imports = Blaze.toHTML(Template.imports)
})
Meteor.startup(function(){
//...
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.