Add option to include WAI middleware for the preview server. #1056
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adds the option to add middleware between the HTTP server and the static file serving to the configuration.
Update a number of functions to use the configuration as much as possible, instead of using the configuration to compute some values and then using these as arguments. The list of parameters was getting pretty long for some of these.
Add some more documentation for
Hakyll.Core.Configuration
and organize into sections to make it clearer what may be optional and how to use things.Add a
middlewareRefresh
function for easily addingRefresh
HTTP headers. (This is the main motivation I have for this change.)Other potential utility middleware that could be added in the future are overriding MIME types (although this one can already be done by using custom server settings) or directing the request to different files depending on HTTP headers such as
Accept-Language
.After switching windows to manually reload preview pages so many times, I wanted pages to be reloaded automatically. I was a conflicted between providing a specific configuration field only for enabling automatic refresh or generic field for inserting arbitrary WAI middleware. I settled on the latter; while it may give too much flexibility and make it possible to use the preview server in ways it really should not be, it can subsume a lot of extra fields that anyone may want to add to the configuration in the future. And maybe we shouldn't try too hard to prevent people from doing what they want.