Mephisto multiple_asset_hosts support

Mephisto multiple_asset_hosts support

(Dit artikeltje is even in het Engels omdat het interessant kan zijn voor een internationaler publiek).

One of the new features of Rails 2.0 is built-in support for multiple asset hosts. This means you can "cheat" you browsers so they'll load your css, javascript etc faster. For more detailed information about this "issue", I suppose you use our mutual friend or read this interesting article. In Rails 2, you are allowed to put the following code in your config/environments/production.rb:

config.action_controller.asset_host = ""

Your Rail 2 application will now "balance" the links to your javascript files, css files and "assets" such as images over,, and Your visitor's browsers will now think these are all different hosts, and will open more connections to the webserver, making your site appear faster.

However, it seems that Mephisto or at least the Liquid templating engine it uses, doesn't use the standard Rails functions to calculate the asset hosts, it just constructs them by hand, which kind of sucks of course.

With the help of my colleague Jan, I've written a small plugin you can install that will use the distributed asset hosts feature. You can install it using the following command:

script/plugin install

Enjoy :)

Frank Louwers

Frank Louwers

Ondernemer. Techneut. Zeiler (te weinig). Skiier (te weiniger). Verzuchter (soms te veel). Vader (zoveel mogelijk) van 2. Momenteel bezig met crypto en GDPR. Profielfoto (c) Leen Van Severen

comments powered by Disqus