rstacruz / sinatra-assetpack

Package your assets transparently in Sinatra.
http://ricostacruz.com/sinatra-assetpack/
MIT License
542 stars 96 forks source link

Adds ability to disable automatic image dimension application to <img> elements. #121

Closed bentruyman closed 11 years ago

bentruyman commented 11 years ago

We're experiencing issues with our responsive design implementation when images have explicit widths are applied to them. This is also an issue when serving 2x images for high-density displays. Typically, we want images to simply take up only the space that they are provided since they'll likely be in a flexible container.

Normally this works fine, but IE8 in particular is having issues with max-width: 100% and height: auto on images that have an explicit width.

This PR allows you to disable that functionality.

j15e commented 11 years ago

The real fix would be to provide an helper named something like asset_path which would return only the url of an asset, not an HTML tag, which would avoid having such setting.

I think what I will do in the end is simply removing the auto image size feature as it will annoy more than help most front-end people, what do you think?

cc @renaudleo @cloutierlp

bentruyman commented 11 years ago

Removing it would also work. It's not much work to re-add the dimensions manually. And with responsive design, you rarely ever specify the dimensions.

renaudleo commented 11 years ago

I agree we should probably just remove it, or at least not make it the default behavior. As @bentruyman said, you now rarely specify dimensions unless you're serving 2x images, which, anyway would not work with the actual behavior.

That being said, an asset_path helper would probably be great too, even if the auto image size attributes is removed.