Description
I believe this began with release 3.3.0, and is a regression caused by #476
Let's say we have an application.css.erb
with this in it:
@font-face {
src: url('<%= font_path('example.eot') %>');
}
And we have config.asset_host = '//example.org'
. (The //
protocol-agnostic asset_host is a common setting for CDNs, often recommended in docs).
With sprockets-rails 3.3.0+, if you ./bin/rails assets:precompile
, the output at ./public/assets/application-[fingerprint].css
looks like:
@font-face {
src: url(//example.com/example.com/fonts/example.eot);
}
Note that //example.com/example.com
is there twice. This reproduces with sprockets rails 3.3.0 and 3.4.1. (both with sprockets 4.0.2).
If you downgrade to sprockets 3.2.2, the output is as expected:
@font-face {
src: url('//example.com/fonts/example.eot');
}
I believe this is a regression beginning with sprockets-rails 3.3.0.
I actually ran into this using font-awesome-rails on an app that deploys to heroku, with a CDN config.asset_host
. font-awesome-rails uses the font_path
helper in a .css.erb
here. While that font-awesome-rails gem may be no longer supported, we ought not to get a regression in a minor sprockets-rails release. But also, I then isolated the reproduction as above, which also seems to be a general problem. It may be possible to isolate/generalize further, may also occur with sass-rails helpers not just the erb ones? May occur with other helpers, not just font_path
?