From e900a5d4e97e9d461afd1dfd6ab8b33f3a471c37 Mon Sep 17 00:00:00 2001 From: Pritesh Date: Thu, 9 Aug 2012 13:48:21 +0100 Subject: [PATCH] Initial documentation changes for asset pipeline support. refs #54 --- doc/README.textile | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/doc/README.textile b/doc/README.textile index dd63aaa..10a2a01 100644 --- a/doc/README.textile +++ b/doc/README.textile @@ -50,9 +50,11 @@ $app_root stylesheets/ <-- default asset pipeline folder themes/ <-- your themes root [theme_name] - images/ - stylesheets/ - javascripts/ + assets/ <-- this is your theme_assets_dir + [theme_name] <-- this ensures that the assets are namespaced and don't clobber eachother. + images/ + stylesheets/ + javascripts/ views/ <- you can override application views layouts/ <- layout .rhtml or .liquid templates @@ -64,8 +66,7 @@ Create an initializer for themes in your {Rails.root}/config/initializers direct ThemesForRails.config do |config| # # If you have placed your themes like the example path above within the asset pipeline: - config.themes_dir = 'assets' - config.assets_dir = 'app/assets/themes' + config.assets_dir = 'app/assets/themes/:name/assets' # ... end @@ -94,9 +95,11 @@ $app_root stylesheets/ <-- default asset pipeline folder themes/ <-- your themes root [theme_name] - images/ - stylesheets/ - javascripts/ + assets/ <-- this is your theme_assets_dir + [theme_name] <-- this ensures that the assets are namespaced and don't clobber eachother. + images/ + stylesheets/ + javascripts/ views/ themes/ <-- note themes folder lives under views in this scenario [theme_name] @@ -111,7 +114,7 @@ ThemesForRails.config do |config| # # If you have placed your themes like the example path above within the asset pipeline: config.themes_dir = 'assets' - config.assets_dir = 'app/assets/themes' + config.assets_dir = 'app/assets/themes/:name/assets' config.views_dir = 'app/views/themes' # ... end @@ -207,15 +210,15 @@ h3. Url Helpers In your views you should be able to access your assets like this (given the theme 'default' is set):
-current_theme_image_path('logo.png')   # => /themes/default/images/logo.png
-current_theme_stylesheet_path('style') # => /themes/default/stylesheets/logo.css
-current_theme_javascript_path('app')   # => /themes/default/stylesheets/app.js
+current_theme_image_path('logo.png')   # => /assets/default/images/logo.png
+current_theme_stylesheet_path('style') # => /assets/default/stylesheets/logo.css
+current_theme_javascript_path('app')   # => /assets/default/stylesheets/app.js
 
Or a given theme:
-current_theme_image_path('logo.png', 'purple')   # => /themes/purple/images/logo.png
+current_theme_image_path('logo.png', 'purple')   # => /assets/purple/images/logo.png
 
In your application views, there are theme specific helper tags @@ -360,4 +363,4 @@ h2. Last but not least If you are using this gem, please, take a minute to recommend me at Working With Rails. -Recommend Me \ No newline at end of file +Recommend Me