middleman: Middleman won't reload helpers when helpers are edited (though it claims to reload itself)
When i edit a helper under /helpers/, Middleman says:
== The Middleman is reloading
== The Middleman has reloaded
But changes in the helper are not applied. I have to restart Middleman manually every time i edit a helper.
Tested on Windows.
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Reactions: 1
- Comments: 37 (13 by maintainers)
Commits related to this issue
- Reload MM on environment and helpers_dir changes. Closes #1274. Closes #1105 — committed to middleman/middleman by tdreyno 10 years ago
- Fixes #1105 — committed to middleman/middleman by tdreyno 6 years ago
- Fix reloading of Ruby files in `lib` directory See https://github.com/middleman/middleman/issues/1105. — committed to patbl/personal-site by patbl a year ago
Okay, I might be able to hack it in there ๐ Let me think about it.
As @tdreyno wrote,
requireonly reads files the first time. However, there isload, which just loads that file each time you call it.Since
config.rbis re-evaluated each time Middleman reboots, this will successfully reload helpers:If you have nested helpers, you need to adapt the glob string to something like
'helpers/**/*'.@jsoref I replaced
requirewithloadin our internal code and added some tests. It seems to work in the base case.No solution yet?
In the meantime, this is a very crude way to reload middleman when any ruby changes. (There are probably more elegant ways to do this, but itโs what I ended up getting working)
You can also use guard-middleman which will rebuild the actual html every time something changes, but I just wanted to stick with the ruby server for now.
This is also handy because it will restart whenever
lib/changes