Skip to content
Juanito Fatas edited this page Oct 2, 2013 · 17 revisions

Theming

Available themes

Here are some other themes you can use:

If you want to use Forem-Boostrap, add this line to Gemfile:

gem 'forem-bootstrap', :github => "radar/forem-bootstrap"

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 (be sure to replace {theme} with the name of the theme you are using, like 'base'):

*= require "forem/{theme}"

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, you may use the following line, replacing {theme} as above:

<%= stylesheet_link_tag "forem/{theme}" %>
Clone this wiki locally