Module: ThemesForRails::Routes

Included in:
ActionDispatch::Routing::Mapper
Defined in:
lib/themes_for_rails/routes.rb

Instance Method Summary collapse

Instance Method Details

#themes_for_railsObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/themes_for_rails/routes.rb', line 5

def themes_for_rails
  theme_dir = ThemesForRails.config.themes_routes_dir
  constraints = { :theme => /[\w\.]*/ } 
  
  # Lets not pollute the routes if they aren't being used.
  unless ThemesForRails.config.asset_digests_enabled?
    get "#{theme_dir}/:theme/stylesheets/*asset" => 'themes_for_rails/assets#stylesheets',
      :as => :base_theme_stylesheet, :constraints => constraints
    get "#{theme_dir}/:theme/javascripts/*asset" => 'themes_for_rails/assets#javascripts',
      :as => :base_theme_javascript, :constraints => constraints
    get "#{theme_dir}/:theme/images/*asset" => 'themes_for_rails/assets#images',
      :as => :base_theme_image, :constraints => constraints
  end
end