overstimulate

Re-skinning a live rails site

Sat, 07 May 2005 rails typo comments

Since upgrading to Typo 2, I’ve wanted to work on a new skin for the site. Since Typo is pretty good about laying things out semantically, this entails create a new CSS layout, not modifying any of the controllers/views (for the most part).

Usually I wouldn’t recommend working on a live site, but in the case of creating a new CSS redesign we won’t need to change any of the code. Thus, making one modification to your code to switch between which stylesheet using IP address is sufficient.

In your layout view, check if @request.remote_ip is the ip address of the machine you are going to be doing the redesign from, if so, specify the new stylesheet.

<% if @request.remote_ip == '12.203.160.185' %>
    <%= stylesheet_link_tag "new_style" %>
<% else %>
    <%= stylesheet_link_tag "current_style" %>
<% end %>

Be careful to use new filenames for images and other resources.


Responses to "Re-skinning a live rails site"

Leave a response

My Card Add to your Address Book

Jesse Andrews
open source, web browsers, web services, web sites & folk dancing. contacts/sites

Keep Up To Date

Get updates via RSS or
get email when I blog

Previous Blog Posts