jeremyevans / roda

Routing Tree Web Toolkit
http://roda.jeremyevans.net
MIT License
2.08k stars 141 forks source link

Add pretty public plugin #216

Closed jaredcwhite closed 2 years ago

jaredcwhite commented 2 years ago

Supersedes #215.

plugin :pretty_public

route do |r|
  r.pretty_public
end

makes this work:

/path/to/file => /path/to/file.html
/another/path => /another/path/index.html

And there are options to override the list of extensions checked as well as switch it to prioritize files over folders with an index.

BTW, if you can think of a better name than pretty_public I'm all ears. I thought of extensionless_public but that's quite a mouthful!

P.S. I was hoping to test this working in conjunction with multi_public, but that would require a change to public_path_segments in the public plugin to accept the specific Rack::File server root.

jeremyevans commented 2 years ago

As requested in #215, can you please post about this on the Google Group and see if there is community support for this to be included with Roda?

jeremyevans commented 2 years ago

I don't want to keep this in limbo indefinitely. There doesn't seem to be a strong desire from the community to include this with Roda, so I think it's best kept as an external plugin. If you decide to release it as an external plugin, please consider sending a PR to add a link to the external plugin on the website (edit www/pages/documentation.erb).

jaredcwhite commented 2 years ago

OK, I probably won't be able to get to it until after finishing up the Bridgetown 1.0 release, but then I'll definitely submit a link for the docs.