From 703b00947d745cbbe33f570762817151f8d7ef2b Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Tue, 28 Jun 2011 08:22:38 +1000 Subject: [PATCH] [Asset pipeline] Move external assets section down to 'Adding assets to your gems' section --- railties/guides/source/asset_pipeline.textile | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/railties/guides/source/asset_pipeline.textile b/railties/guides/source/asset_pipeline.textile index 94c6cb9fb7..db13817535 100644 --- a/railties/guides/source/asset_pipeline.textile +++ b/railties/guides/source/asset_pipeline.textile @@ -37,10 +37,6 @@ Assets can be placed inside an application in one of three locations: +app/asset Any subdirectory that exists within these three locations will be added to the search path for Sprockets (visible by calling +Rails.application.config.assets.paths+ in a console). When an asset is requested, these paths will be looked through to see if they contain an asset matching the name specified. Once an asset has been found, it's processed by Sprockets and then served up. -h4. External Assets - -Assets can also come from external sources such as engines. A good example of this is the +jquery-rails+ gem which comes with Rails as the standard JavaScript library gem. This gem contains an engine class which inherits from +Rails::Engine+. By doing this, Rails is informed that the directory for this gem may contain assets and the +app/assets+, +lib/assets+ and +vendor/assets+ directories of this engine are added to the search path of Sprockets. - h4. Serving Assets To serve assets, we can use the same tags that we are generally familiar with: @@ -102,7 +98,9 @@ Sprockets also creates a "Gzip":http://en.wikipedia.org/wiki/Gzip (.gz) of your h3. Adding Assets to Your Gems -To include your assets inside of a gem, simple package it in +lib/assets+ as you would in +app/assets+. You should append or prepend the name of your gem though, this should help avoid name conflicts with other gems or the user's application. +Assets can also come from external sources in the form of gems. + +A good example of this is the +jquery-rails+ gem which comes with Rails as the standard JavaScript library gem. This gem contains an engine class which inherits from +Rails::Engine+. By doing this, Rails is informed that the directory for this gem may contain assets and the +app/assets+, +lib/assets+ and +vendor/assets+ directories of this engine are added to the search path of Sprockets. h3. Making Your Library or Gem a Pre-Processor