Skip to content

Commit

Permalink
Initial documentation changes for asset pipeline support. refs lucase…
Browse files Browse the repository at this point in the history
  • Loading branch information
jasherai committed Aug 9, 2012
1 parent bc7b7e3 commit e900a5d
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions doc/README.textile
Original file line number Diff line number Diff line change
Expand Up @@ -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
</pre>
Expand All @@ -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
</pre>
Expand Down Expand Up @@ -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]
Expand All @@ -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
Expand Down Expand Up @@ -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):

<pre>
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
</pre>

Or a given theme:

<pre>
current_theme_image_path('logo.png', 'purple') # => /themes/purple/images/logo.png
current_theme_image_path('logo.png', 'purple') # => /assets/purple/images/logo.png
</pre>

In your application views, there are theme specific helper tags
Expand Down Expand Up @@ -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.

<a href="http://www.workingwithrails.com/recommendation/new/person/7277-lucas-florio"><img alt="Recommend Me" src="http://workingwithrails.com/images/tools/compact-small.jpg" /></a>
<a href="http://www.workingwithrails.com/recommendation/new/person/7277-lucas-florio"><img alt="Recommend Me" src="http://workingwithrails.com/images/tools/compact-small.jpg" /></a>

0 comments on commit e900a5d

Please sign in to comment.