aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/asset_pipeline.textile
diff options
context:
space:
mode:
authorLeonard Garvey <lengarvey@gmail.com>2011-06-18 21:20:19 +1000
committerLeonard Garvey <lengarvey@gmail.com>2011-06-18 21:20:19 +1000
commit38aa153f9e18951c274a6554e04a8830a36e50c1 (patch)
tree782b8f75e00306ad8c4d700b06009f0c2b78998b /railties/guides/source/asset_pipeline.textile
parentfb9bfc2430924bced50f4cc285374bfdeb83f685 (diff)
parent4f301b25402fb8736921752ceba5ba79c37bfd12 (diff)
downloadrails-38aa153f9e18951c274a6554e04a8830a36e50c1.tar.gz
rails-38aa153f9e18951c274a6554e04a8830a36e50c1.tar.bz2
rails-38aa153f9e18951c274a6554e04a8830a36e50c1.zip
Merge github.com:lifo/docrails
Diffstat (limited to 'railties/guides/source/asset_pipeline.textile')
-rw-r--r--railties/guides/source/asset_pipeline.textile16
1 files changed, 8 insertions, 8 deletions
diff --git a/railties/guides/source/asset_pipeline.textile b/railties/guides/source/asset_pipeline.textile
index 5af3dff41a..a795b88ef5 100644
--- a/railties/guides/source/asset_pipeline.textile
+++ b/railties/guides/source/asset_pipeline.textile
@@ -49,7 +49,7 @@ To serve assets, we can use the same tags that we are generally familiar with:
<%= image_tag "rails.png" %>
</erb>
-Providing that assets are enabled within our application (+Rails.application.config.assets.enabled+ is set to +true+), this file will be served by Sprockets unless a file at +public/images/rails.png+ exists, in which case that file will be served. If there is no file at +public/images+, Sprockets will look through the available paths until it finds a file that matches the name and then will serve it, first looking in the application's assets directories and then falling back to the various engines of the application.
+Providing that assets are enabled within our application (+Rails.application.config.assets.enabled+ is set to +true+), this file will be served by Sprockets unless a file at +public/assets/rails.png+ exists, in which case that file will be served. If there is no file at +public/assets+, Sprockets will look through the available paths until it finds a file that matches the name and then will serve it, first looking in the application's assets directories and then falling back to the various engines of the application.
To include a JavaScript file we can still use the familiar +javascript_include_tag+.
@@ -72,9 +72,9 @@ Sprockets allows some assets to be manifest files. These manifest files require
For example, in the default Rails application there's a +app/assets/javascripts/application.js+ file which contains the following lines:
<plain>
- //= require jquery
- //= require jquery_ujs
- //= require_tree .
+//= require jquery
+//= require jquery_ujs
+//= require_tree .
</plain>
In JS files, directives begin with +//=+. In this case, the file is using the +require+ directive twice and the +require_tree+ directive once. The +require+ directive tells Sprockets that we would like to require a file called +jquery.js+ that is available somewhere in the search path for Sprockets. By default, this is located inside the +vendor/assets/javascripts+ directory contained within the +jquery_rails+ gem. An identical event takes place for the +jquery_ujs+ require specified here also.
@@ -84,10 +84,10 @@ The +require_tree .+ directive tells Sprockets to include _all_ JavaScript files
There's also a default +app/assets/stylesheets/application.css+ file which contains these lines:
<plain>
- /* ...
- *= require_self
- *= require_tree .
- */
+/* ...
+*= require_self
+*= require_tree .
+*/
</plain>
The directives that work in the JavaScript files will also work in stylesheets, obviously requiring stylesheets rather than JavaScript files. The +require_tree+ directive here works the same way as the JavaScript one, requiring all stylesheets from the current directory.