How to specify absence of protocol in css urls

82 views Asked by At

I want to specify relative protocol, but can not.

In config/environments/production.rb I have following lines:

S::Application.configure do
  config.action_controller.asset_host = '//example.com'
end

As you can see host without protocol.

In assets/stylesheets/test.css.scss

.test1 {
  background-image: url(asset_path('spritesheet1.png'));
}
.test2 {
  background-image: asset_url('spritesheet1.png');
}
.test3 {
   background-image: asset-url('spritesheet1.png');
}

Then

RAILS_ENV=production rake assets:precompile

The result in app is:

.test1{background-image:url("http://example.com/spritesheet1.png")}
.test2{background-image:url(http://example.com/spritesheet1.png)}
.test3{background-image:url(http://example.com/spritesheet1.png)}

Why is there a protocol http?

0

There are 0 answers