Possibility to change where CSS url()s is loaded from, to enable CDN for CSS loaded images #222

Closed
wants to merge 4 commits into
from

Conversation

Projects
None yet
2 participants
@PatrickLef

This makes it possible to set a host for your assets, which will then be used for the CSSs to change url(/foobar.jpg) to url(http://cdn.example.com/foobar.jpg). Which I needed to be able to put larger images that I don't want to base64 encode in my CDN.

With this came 2 more problems.

  1. Cloudfront don't support setting a Access-Control-Allow-Origin header on your files, which means that fonts still have to be loaded from your domain. Therefor I added a setting where you can set which file extensions that should not be loaded from the asset host.
  2. While it was possible to set file extensions that shouldn't be loaded from the asset host, that also meant that fonts included from CSS using /font.woff would be loaded from the asset hosts root instead of the web site. Therefor I had to add a setting where you can set where the web host is.

If you find this patch interesting, I would gladly update the docs and write som specs for it!

PatrickLef added some commits Feb 24, 2012

Added asset_host option to make it possible to set where the assets a…
…re going to be stored. So that CSS can have absolute paths on other domain. To enable CDNs
Made it possible to set a web host that is used for css includes that…
… doesn't use the asset_host. To enable fonts being loaded on the same domain as the web page to solve cross-domain issues.
@hemang

This comment has been minimized.

Show comment Hide comment
@hemang

hemang May 13, 2012

cool stuff. Interesting!

hemang commented May 13, 2012

cool stuff. Interesting!

@PatrickLef PatrickLef closed this May 14, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment