Skip to content

Commit

Permalink
copy editing asset pipeline changes
Browse files Browse the repository at this point in the history
  • Loading branch information
vijaydev committed Jan 16, 2012
1 parent 96e5d10 commit 39d4878
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions railties/guides/source/asset_pipeline.textile
Expand Up @@ -121,24 +121,25 @@ h5. Search paths

When a file is referenced from a manifest or a helper, Sprockets searches the three default asset locations for it.

The default locations are: The subdirectory +images+ under +app/assets+, and the subdirectories +javascripts+ and +stylsheets+ in all three asset locations.
The default locations are: +app/assets/images+ and the subdirectories +javascripts+ and +stylesheets+ in all three asset locations.

For example, these files:

<plain>
app/assets/javascripts/home.js
lib/assets/javascripts/moovinator.js
vendor/assets/javascript/slider.js
</plain>

would be referenced in a manfest like this:
would be referenced in a manifest like this:

<plain>
//= require home
//= require moovinator
//= require slider
</plain>

Asset in subdirectories can also be accessed.
Assets inside subdirectories can also be accessed.

<plain>
app/assets/javascripts/sub/something.js
Expand Down Expand Up @@ -166,17 +167,15 @@ h5. Using index files

Sprockets uses files named +index+ (with the relevant extensions) for a special purpose.

To explain by example, if you have a jQuery library with many modules this can be stored in +lib/assets/library_name+.

The file +lib/assets/library_name/index.js+ serves as the manifest for all files in this library. This file could include a list of all the required files in order, or a simple require_tree directive.
For example, if you have a jQuery library with many modules, which is stored in +lib/assets/library_name+, the file +lib/assets/library_name/index.js+ serves as the manifest for all files in this library. This file could include a list of all the required files in order, or a simple <tt>require_tree</tt> directive.

The library as a whole can be accessed in the site's application manifest like so:

<plain>
//= require library_name
</plain>

This simplifies maintainance and keeps things clean by allowing related code to be grouped before inclusion elsewhere.
This simplifies maintenance and keeps things clean by allowing related code to be grouped before inclusion elsewhere.

h4. Coding Links to Assets

Expand Down

0 comments on commit 39d4878

Please sign in to comment.