fukamachi / caveman

Lightweight web application framework for Common Lisp.
http://8arrow.org/caveman/
775 stars 63 forks source link

Opinion - all assets in static/ should serve by default #47

Open ghost opened 9 years ago

ghost commented 9 years ago

On Hunchentoot, all assets in the web base will serve. As it is common to add third party assets (such as bootstrap) into their own directory, and not mixed with user created css/js, I think it would be more intuitive for a user to be able to just drop in the 'bootstrap-3' directory into "static/" without any additional configuration required.

In my case, I added a "static/assets/" directory and updated the css/js/image regex to match on that as well, but I think it is a silly workaround.

fukamachi commented 9 years ago

Why I'm not very interested in the idea, it may conflict with application's routes.

For example, if you have a route like "/data/:id.json" and also have a directory "/data/" in "static/", the route never been called.

I have a more serious example. Using users' name in routes like "https://github.com/fukamachi" is commonly used, but if there's an user named "data" and you have a directory "static/data/", the user cannot see his/her own user page unexpectedly.

The problem would be caused if there's a user named "js" or "css", however it can be controlled easily.