From c9cc535d2be6a30ee0f921c996f5d27c62070f66 Mon Sep 17 00:00:00 2001 From: Sergey Parizhskiy Date: Mon, 5 Dec 2011 16:25:02 +0200 Subject: changes in the way of how the stylesheets_link_tag works --- railties/guides/source/layouts_and_rendering.textile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'railties/guides/source') diff --git a/railties/guides/source/layouts_and_rendering.textile b/railties/guides/source/layouts_and_rendering.textile index 6c050e27d6..8ff2408d16 100644 --- a/railties/guides/source/layouts_and_rendering.textile +++ b/railties/guides/source/layouts_and_rendering.textile @@ -744,7 +744,7 @@ And use them by referencing them exactly like +:defaults+: <%= javascript_include_tag :projects %> -When using :defaults, if an application.js file exists in public/javascripts it will be included as well at then end. +When using :defaults, if an application.js file exists in public/javascripts it will be included as well at the end. Also, if the Asset Pipeline is disabled, the +:all+ expansion loads every JavaScript file in +public/javascripts+: @@ -777,19 +777,23 @@ You can even use dynamic paths such as +cache/#{current_site}/main/display+. h5. Linking to CSS Files with the +stylesheet_link_tag+ -The +stylesheet_link_tag+ helper returns an HTML +<link>+ tag for each source provided. Rails looks in +public/stylesheets+ for these files by default, but you can specify a full path relative to the document root, or a URL, if you prefer. For example, to include +public/stylesheets/main.css+: +The +stylesheet_link_tag+ helper returns an HTML +<link>+ tag for each source provided. + +If you are using Rails with the "Asset Pipeline" enabled, this helper will generate a link to +/assets/stylesheets/+. This link is then processed by the Sprockets gem. A stylesheet file can be stored in one of three locations: +app/assets+, +lib/assets+ or +vendor/assets+. + +You can specify a full path relative to the document root, or a URL. For example, to link to a stylesheet file that is inside a directory called +stylesheets+ inside of one of +app/assets+, +lib/assets+ or +vendor/assets+, you would do this: <%= stylesheet_link_tag "main" %> -To include +public/stylesheets/main.css+ and +public/stylesheets/columns.css+: +To include +app/assets/stylesheets/main.css+ and +app/assets/stylesheets/columns.css+: <%= stylesheet_link_tag "main", "columns" %> -To include +public/stylesheets/main.css+ and +public/photos/columns.css+: +To include +vendor/assets/stylesheets/main.css+ and +lib/assets/stylesheets/photos/columns.css+: <%= stylesheet_link_tag "main", "/photos/columns" %> @@ -807,7 +811,7 @@ By default, the +stylesheet_link_tag+ creates links with +media="screen" rel="st <%= stylesheet_link_tag "main_print", :media => "print" %> -The +all+ option links every CSS file in +public/stylesheets+: +If the Asset Pipeline is disabled, the +all+ option links every CSS file in +public/stylesheets+: <%= stylesheet_link_tag :all %> -- cgit v1.2.3