Skip to content
fzf edited this page Jun 15, 2012 · 7 revisions

A theme, in ThemeForRails, is composed of two things:

  • Views: Haml, ERB, and so on.
  • Static Assets: Images, Stylesheets, Javascripts, etc.

So, in order to define a theme you need at least one of those things. The default structure of a theme looks like this:

$app_root
  themes/
    [theme_name]
      images/
      stylesheets/
      javascripts/
      views/           <- you can override application views
        layouts/         <- layout .rhtml or .liquid templates

But you can change this easily by adding an initializer file to config/initializers with the following:

# config/initializers/tfr.rb
ThemesForRails.config do |config|
  # your static assets on Rails.root/themes/pink/assets/{stylesheets,javascripts,images}
  config.assets_dir = ":root/themes/:name/assets" 
end

Add themes_for_rails to your routes file

# config/routes.rb
Application.routes.draw do
  themes_for_rails
end

See more options visiting the Configuration’s Wiki Page.

Other documents

Clone this wiki locally