简体   繁体   English

把手和缓存(模板不更新)

[英]Handlebars and caching (template not updating)

I've working with Handlebars for a while now and never had any issues.我已经使用 Handlebars 一段时间了,从来没有遇到任何问题。 However recently my development cycle has been disturbed.然而最近我的开发周期被打乱了。 Handlebars or nodejs for that matter seems to (what I think) cache my templates and refuse to update, even after a server restart.与此相关的 Handlebars 或 nodejs 似乎(我认为)缓存我的模板并拒绝更新,即使在服务器重新启动后也是如此。

I tried reading the documentation over at http://handlebarsjs.com but not much is said.我尝试阅读http://handlebarsjs.com 上的文档,但内容不多。 As stated I don't really know if this is a Handlebars issue or if it is node.如前所述,我真的不知道这是 Handlebars 问题还是 node.js 问题。

How does one debug this kind of issue?如何调试这种问题?

I had a similar problem.我有一个类似的问题。 I was testing in Chrome and found an option to turn off browser caching when f12 tools are up.我在 Chrome 中进行测试,发现有一个选项可以在 f12 工具启动时关闭浏览器缓存。 You can find it under Settings in f12 tools screen您可以在 f12 工具屏幕的设置下找到它

I too hit this error.我也遇到了这个错误。

Tested in different browsers, so no way is this a cache issue.在不同的浏览器中测试过,所以这不可能是缓存问题。

For me, the fix was to restart my node server manually.对我来说,修复方法是手动重新启动我的节点服务器。 For some reason, changes to .hbs files didn't trigger a nodemon restart automatically.出于某种原因,对 .hbs 文件的更改不会自动触发nodemon重新启动。

Info posted here to aid others who may hit this bump in the road.此处发布的信息是为了帮助可能在路上遇到这种颠簸的其他人。

Not sure if this solves your problem, but in my case, it was a bug in my code.不确定这是否能解决您的问题,但就我而言,这是我代码中的一个错误。

I accidentally didn't put "const" or "var" before a variable in an async function.我不小心没有在异步函数中的变量之前放置“const”或“var”。 As a result, the variable was accidentally declared in a global scope.结果,意外地在全局范围内声明了该变量。 Concurrent requests had the wrong value.并发请求的值错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM