Handle asset gems in a sane manner

This allows us to conditionally require asset-related gems instead of hardcoding them into the gemspec.

Related issues: #437, #1259, #1686