-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always call 'getGeneratorContent' for posts in watch mode #98
Conversation
Fixes a regression introduced in 0a7c669
I ran into this same issue. I'd like to test out a build from this branch, but I'm unsure if there is a quick/easy way to try it out? It looks like |
I'm not sure why, but for me the latest stable fornax doesn't crash anymore! |
I still don't know why the stable release works fine when development builds continue to crash. At least I'm sure it's not the build configuration: the complete invocation of the Build and Publish targets contain $ FAKE_SDK_RESOLVER_CUSTOM_DOTNET_PATH=/usr/share/dotnet dotnet fake build -t TestTemplate
$ echo -e "\n\n### More\n" >> src/Fornax.Template/posts/post.md
|
Closing now that bafe619 has been merged |
Since 0a7c669,
Generator.GeneratorEvaluator.evaluate
loads a generator script from a cache:Fornax/src/Fornax/Generator.fs
Lines 180 to 191 in 0a7c669
But reusing the
post.fsx
generator crashes fornax in watch mode; thesiteContent
variable is empty the second time around:As long as
getGeneratorContent
is called in the rebuild cycle, file watching works as intended:issue-96-patch-demo.mp4
This patch makes
evaluate
aware of watch mode(*) so thatgetGeneratorContent
can be called on Markdown pages after a file change event.Fixes #96
Closes #84 (specifically #84 (comment))
(*) In practice, by propagating the value of
isWatch
viaGenerator.generateFolder
->Generator.generate
->Generator.GeneratorEvaluator.evaluate
.Because Markdown files are never handled by
Generator.runOnceGenerators
, thereevaluate
is called withisWatch
hard-coded asfalse
, so the former behaviour hasn't changed.Generator.GeneratorEvaluator.evaluateMultiple
is also unchanged because it doesn't use the cache:Fornax/src/Fornax/Generator.fs
Lines 212 to 215 in abd3baa
This could mean sacrificing some of the efficiency that 0a7c669 was aiming for, but IMHO a really efficient file watcher would only rebuild the changed file, not the entire website.
Actual performance will vary: the video above was captured on a Win 8.1-era notebook with a 900 MHz AMD processor