Class: ThemesForRails::Config
- Inherits:
-
Object
- Object
- ThemesForRails::Config
- Includes:
- Interpolation
- Defined in:
- lib/themes_for_rails/config.rb
Instance Attribute Summary collapse
-
#asset_digests_enabled ⇒ Object
Returns the value of attribute asset_digests_enabled.
-
#assets_dir ⇒ Object
relative assets dir for view overloading support used for theme_view_path_for method to get theme path and add to view paths.
- #base_dir ⇒ Object
-
#default_theme ⇒ Object
Returns the value of attribute default_theme.
- #themes_dir ⇒ Object
-
#themes_routes_dir ⇒ Object
This is the base themes dir that is used for mapping URL paths.
-
#use_sass ⇒ Object
Returns the value of attribute use_sass.
-
#views_dir ⇒ Object
relative views directory for theme views to be separated from assets used for Asset Pipeline support.
Instance Method Summary collapse
- #asset_digests_enabled? ⇒ Boolean
- #clear ⇒ Object
-
#initialize(&block) ⇒ Config
constructor
A new instance of Config.
- #sass_is_available? ⇒ Boolean
-
#themes_path ⇒ Object
Full path to themes.
- #use_sass? ⇒ Boolean
Methods included from Interpolation
Constructor Details
#initialize(&block) ⇒ Config
Returns a new instance of Config.
10 11 12 13 14 15 |
# File 'lib/themes_for_rails/config.rb', line 10 def initialize(&block) @use_sass = true @default_theme = 'default' @asset_digests_enabled = nil yield if block_given? end |
Instance Attribute Details
#asset_digests_enabled ⇒ Object
Returns the value of attribute asset_digests_enabled.
6 7 8 |
# File 'lib/themes_for_rails/config.rb', line 6 def asset_digests_enabled @asset_digests_enabled end |
#assets_dir ⇒ Object
relative assets dir for view overloading support used for theme_view_path_for method to get theme path and add to view paths. Defaults to themes_dir for non asset pipeline users
If you are using the Rails Asset Pipeline, this should be changed to the path of your assets in your app. For example, if you store your themes under /app/assets/themes - Rails.root/app/assets/themes you would need to set this to ‘app/assets/themes’ in your initializer config
29 30 31 |
# File 'lib/themes_for_rails/config.rb', line 29 def assets_dir @assets_dir ||= ":root/themes/:name" end |
#base_dir ⇒ Object
17 18 19 |
# File 'lib/themes_for_rails/config.rb', line 17 def base_dir @base_dir ||= Rails.root.to_s end |
#default_theme ⇒ Object
Returns the value of attribute default_theme.
6 7 8 |
# File 'lib/themes_for_rails/config.rb', line 6 def default_theme @default_theme end |
#themes_dir ⇒ Object
39 40 41 |
# File 'lib/themes_for_rails/config.rb', line 39 def themes_dir @themes_dir ||= ":root/themes" end |
#themes_routes_dir ⇒ Object
This is the base themes dir that is used for mapping URL paths.
If you are using the Rails Asset Pipeline, this should be changed to the prefix dir of your assets path. For example, if you store your themes under /app/assets/themes - Rails.root/app/assets/themes you would need to set this value to ‘assets’ to match up with the Sprockets path resolution process.
56 57 58 |
# File 'lib/themes_for_rails/config.rb', line 56 def themes_routes_dir @themes_routes_dir ||= "themes" end |
#use_sass ⇒ Object
Returns the value of attribute use_sass.
6 7 8 |
# File 'lib/themes_for_rails/config.rb', line 6 def use_sass @use_sass end |
#views_dir ⇒ Object
relative views directory for theme views to be separated from assets used for Asset Pipeline support. Defaults to match #assets_dir/views
35 36 37 |
# File 'lib/themes_for_rails/config.rb', line 35 def views_dir @views_dir ||= ":root/themes/:name/views" end |
Instance Method Details
#asset_digests_enabled? ⇒ Boolean
75 76 77 |
# File 'lib/themes_for_rails/config.rb', line 75 def asset_digests_enabled? @asset_digests_enabled end |
#clear ⇒ Object
60 61 62 63 64 65 |
# File 'lib/themes_for_rails/config.rb', line 60 def clear @base_dir = nil @themes_dir = nil @assets_dir = nil @views_dir = nil end |
#sass_is_available? ⇒ Boolean
71 72 73 |
# File 'lib/themes_for_rails/config.rb', line 71 def sass_is_available? !!defined?Sass::Plugin end |
#themes_path ⇒ Object
Full path to themes
44 45 46 |
# File 'lib/themes_for_rails/config.rb', line 44 def themes_path interpolate(themes_dir) end |
#use_sass? ⇒ Boolean
67 68 69 |
# File 'lib/themes_for_rails/config.rb', line 67 def use_sass? @use_sass and sass_is_available? end |