-
Notifications
You must be signed in to change notification settings - Fork 95
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
In development - handling assets that don't exist #19
Comments
Sounds like a great idea. Do you have the chance to try it out and create a pull request? |
However, after giving it some more thought it only raises an exception in the development environment as all assets are served via the default Sinatra public folder in production. Do you still think we need the if statement? |
It's a very minor detail that I only noticed because I was migrating an app from rake-pipeline to this and some of our previous urls were displaying this error instead of 404'ing (or something else to tell me that the asset didn't exist). It took me a while to figure out that I had a path mis-configured. With using sprockets-helpers you shouldn't ever be able to generate a URL to an asset that doesn't exist, so in theory it wouldn't matter too much. Only use case I could come up with is if an implementer needed their sinatra app to handle certain urls that began with "/assets" ... maybe like if they wanted to use sinatra to dynamically serve a user profile photo - "/assets/user/:id" or something. If it means anything, I think Sprocket's built-in rack middleware passes if it comes across an asset that doesn't exist, but I could be wrong. If you think it's relevant enough to issue a PR I'll do so and test it out. |
Got it, I would love a pull request! |
Closing this issue, please reopen it if you find the time to make a pull request. |
I think this could still be useful, even if it were just a more explicit error message, saying which asset it was trying to find. |
I agree, a friend of mine using this library just ran into the same problem the other day, so I think that we should reopen this, do some work and get this feature in. |
I noticed that an exception is triggered if I try to go to an asset url that doesn't exist instead of a 404 (or handling it gracefully).
Would it be beneficial to include something like
pass if !asset
somewhere around here: https://github.com/kalasjocke/sinatra-asset-pipeline/blob/master/lib/sinatra/asset_pipeline.rb#L50The text was updated successfully, but these errors were encountered: