0

We are coming up with a new twitter bootstrap theme for new functionality within our application. Our existing functionality will use the existing theme with models/controllers.

But I would like to re-use the existing models/controllers and use the new twitter bootstrap theme for the new functionality.

How do I go about addressing this and maintain the code bases (the old app will be on host:port1 and new app will be on host:port2)

Edit :

My old rails application under public/javascripts public/stylesheets. Some of the views are under app/views/foos/ Some of the views are under app/views/bars/

I would the new views under app/views/cars/ How should I reference my new index files to point to the new theme/css under app/assets

diya
  • 6,938
  • 9
  • 39
  • 55

2 Answers2

0

You can switch between css manifest files. So for new theme it could be like

new_theme.css
 /*
 *= bootstrap_alternative_theme
   ... 
 */

old_theme.css
 /*
 *= bootstrap_original_theme
   ... 
 */   

And layouts/application.html.erb

<% if request.port == port1 %>
   <%= stylesheet_link_tag  "old_theme" %>
<% else %>
   <%= stylesheet_link_tag  "new_theme" %>
<% end %>
benchwarmer
  • 2,764
  • 23
  • 25
0

To add to benchwarmer answer, you might have the html and also the javascript modified so you can define a new layout and toggle between old and new layout as per your needs.

But for compiling those assets, assuming your assets are not named application.css or application.js, add a line in your application.rb

config.assets.precompile += %w(new.css new.js)
abhijit
  • 1,958
  • 3
  • 28
  • 39
  • Thanks for your response ! I tried with your suggestion but there is no effect, am unable to get new layout, it still holds the existing theme ! – diya Mar 01 '13 at 09:36
  • @diya, which version of rails your are using, is it < 3.1? – abhijit Mar 01 '13 at 11:14