Skip to content
Ryan Bigg edited this page Nov 27, 2011 · 17 revisions

Theming

Available themes

Here are some other themes you can use:

Blue links, black headers:

gem 'forem-theme-twist', :git => "git://github.com/radar/forem-theme-twist.git"

Brown links, orange headers and posts body:

gem 'forem-theme-orange', :git => "git://github.com/radar/forem-theme-orange.git"

Building your own theme

Forem has support for theming built right in. To apply a theme to the forem engine you must first install a Forem theme gem such as http://github.com/radar/forem-theme-base. These gems must be set up like a Rails engine, like this:

require 'forem'
module Forem
  module Theme
    module Base
      class Engine < Rails::Engine
        Forem.theme = :base
      end
    end
  end
end

The forem gem must first be required so that the Forem module is loaded and has a theme= method defined on it. By defining an engine like this, the hooks to the assets in this engine are created and so stylesheets, JavaScript files and images will be able to be included by either the forem engine itself or its host application.

To then apply the styling of this theme to your application you can place this line in your CSS file:

*= require "forem/{theme}/style"

This line will include the app/assets/stylesheets/forem/base/style.css file from the gem, which should either be a manifest file containing requires for other stylesheets so that Sprockets can read them, or a stylesheet itself. Sprockets will process this.

If you'd rather just outright include the CSS file use stylesheet_link_tag:

<%= stylesheet_link_tag "forem/{theme}/style" %>

Clone this wiki locally