Closed EvanHahn closed 6 years ago
Anything I can do to get this merged? No worries if not.
Sorry, this slid off my todo list. I think rather than having a single option, it would make more sense to have a predicate function instead.
Good idea. I'll do that when I get a chance.
I believe I've addressed comments—dotfiles?
is now a function.
Can you change the :dotfiles?
option to :exclude
instead? The reason for using a function rather than making it a boolean option is to allow for more complex exclusions. So rather than:
(resources "/" {:dot-files? false})
We can write:
(resources "/" {:exclude dot-file?})
Alternatively, I'm wondering about a syntax like:
(-> (resources "/") (exclude dot-file?))
So we'd have a generic exclude route wrapper, though that does mean that we can't have defaults, which in this case might be useful (excluding dot-files is a good default to have).
Hmm, interesting. That first idea seems like it might be worth adding to this PR but the second seems pretty separate (not that it's not worth doing). Your thoughts?
I think having an :exclude
option is best, as that way it can default to dot-file?
Okay. I'll give that a go (again, might be a bit before I can get to it).
Do you want me to make :exclude dot-file?
a default? That'd be a potentially breaking change which is why I hesitate.
Let's not make it a default initially, as you're right that that would be a breaking change.
Created #180 to replace this pull request.
This PR adds a
:dotfiles?
option which allows files that begin with.
to be ignored byroutes/files
androutes/resources
.This is inspired by an option from Express.js's static file middleware.